The given string is something like:
words words {{{value}}} some other words {{{value2}}}
I’m trying the following one:
const string pattern = @"\b({{{)\w+(}}})\b";
Regex optionRegex = new Regex(pattern, RegexOptions.Compiled);
MatchCollection matches = optionRegex.Matches(text);
and @"\b(\{\{\{)\w+(\}\}\})\b" didn’t helped. Please, help to create regex, TIA
Your regex should be:
The problem is that there is no word boundary (
\b) where you were trying to match.You can add the grouping in if you need it, but it seems unlikely that you do since you know that the first group contains
{{{and the second contains}}}. Perhaps you meant to group the word inside: