I am trying to achieve a regex to select (%?[fFsmhd]){1,}
preceded by +
and not by \+
.
My first option was (?<=[^\\]\+)(%?[fFsmhd]){1,}
which seems to work except that the position 1 is never matched.
Test:
+fFsmhd (problem here, does not match)
+fFsmhd (matches)
A workaround I found to this problem is to replace the [^\\]
for a nested negated lookbehind ending up with this disgusting thing: (?<=(?<!\\)\+)(%?[fFsmhd]){1,}
Test:
+fFsmhd (matches)
+fFsmhd (matches)
Is there any better way to achieve this without nest lookbehinds to do a simple [^\\]
?