Created
June 6, 2024 13:32
-
-
Save bjoerntx/0e833871c3f23c67e301ef35f77bf1b8 to your computer and use it in GitHub Desktop.
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
private static List<FieldInfo> FindMergeFields(string input) | |
{ | |
const string pattern = @"\{\{(?!#|/)(.*?)\}\}"; | |
var matches = new List<FieldInfo>(); | |
foreach (Match match in Regex.Matches(input, pattern)) | |
{ | |
matches.Add(new FieldInfo | |
{ | |
StartIndex = match.Index, | |
EndIndex = match.Index + match.Length, | |
FieldName = Regex.Replace(match.Groups[1].Value, @"\s+", "") | |
}); | |
} | |
return matches; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment