I'm pretty new at regular expressions. For a string like this:
[quote="Username;123456]
I have created this regular expression:
%\[quote=("|&\#039;|"|\'|)([^\r\n]*?)[^;](\d+)\]%s
This puts out 3 matches:
Why is [^;]
not negating the semicolon, but instead removing one digit and how can I fix this? Thanks.
Your ([^\r\n]*?)
can eat the ;
, so the [^;]
is free to take a digit (because it will match anything except the ;
).
You probably wanted ;
(without [^ ]
:
%\[quote=("|&\#039;|"|\'|)([^\r\n]*?);(\d+)\]%s