Skip to content

Instantly share code, notes, and snippets.

@bjoerntx
Created January 29, 2021 21:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjoerntx/3b9b1f0b8d6d44f25d25fb18fa899f81 to your computer and use it in GitHub Desktop.
Save bjoerntx/3b9b1f0b8d6d44f25d25fb18fa899f81 to your computer and use it in GitHub Desktop.
public static class MyExtensions {
public static MatchCollection Find(
this TXTextControl.TextControl tx,
string pattern,
RegexOptions regexOptions) {
// replace the CRLFs with LFs to be compatible with
// TextControl's index
var sText = tx.Text.Replace("\r\n", "\n");
// new RegEx and return the matches
Regex rg = new Regex(pattern, regexOptions);
return rg.Matches(sText);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment