I have patterns like the following
header line
a = b
c = d
c = e
f = g
I've come up with the pattern
std::string pat =
"((.*)(\n|\r\n)(\\s|\\t)*?(?<name>([a-z]{1,100}))\\s+=)"
"((.*)(\n|\r\n)(\\s|\\t)*?(?<!\\k<name>{1,100})\\s+=)";
Using ICU's regex I get U_REGEX_LOOK_BEHIND_LIMIT
.
I thought the {1,100}
is what I needed but that has no effect. How do I get the look behind to take the limit I'm giving?
Or is there a simpler way to do this? If it's not clear, I want a pattern that matches whenever the first word of a line is different to the first word of the previous line, so it would match when it encounters c = d
and again when it encounters f =
but wouldn't for c = e
.