Regular Expressions 101

Community Patterns

123...7

Community Library Entry

3

Regular Expression
.NET 7.0 (C#)

@"
\${(\s*((?<rewriter>[^(\s]+)\s*\(\s*(?<key>[^()?\s}]+)\s*\)\s*)|(\s*(?<key>[^()?\s}]+)\s*))(\?(?<fallback>[^}]*))*}
"
gm

Description

.Net regular expression for resolving placeholders in the format of ${rewriter(multilevel:key)?fallback} (+ variations)

Submitted by anonymous - a year ago