Last active
May 21, 2020 19:13
-
-
Save demaderios/8d02e2ad5660909ee50e380e19fb1c15 to your computer and use it in GitHub Desktop.
C# regular expression extractor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static List<string> RegularExpressionExtractor(string input, string regexpattern) | |
{ | |
var regexPatternToMatch = new Regex(regexpattern); | |
var listOfResults = regexPatternToMatch.Matches(input) | |
.Cast<Match>() | |
.Select(m => m.Value) | |
.ToList(); | |
return listOfResults; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I had a need to run some strings through a parser to get specific sections of the string into a list.