Regular Expressions 101

Community Patterns

Negative lookbehind

0

Regular Expression
.NET 7.0 (C#)

@"
(?<!^\s*)(?=<GTOL-[A-Z]+>)
"
gm

Description

There is not word boundary between the >< and as there seem to be at least 1 or more uppercase characters, then quantifier can be + to match 1 or more times. If you don't want to split at the start of the string, creating an empty entry in the result list, you can assert using a negative lookbehind (?<!^\s*) that there are not optional whitespace chars to the left after the start of the string. https://stackoverflow.com/a/73366124/3080770

Submitted by anonymous - 2 years ago