I'm looking for a regex to match all %
that are not followed by a valid 2-characters hex code (2 characters in a-fA-F0-9). I came up with (%)(?=([0-9a-fA-F][^0-9a-fA-F]|[^0-9a-fA-F]))
which works well but is not supported in golang, because of the positive lookahead (?=
).
How can I translate it (or maybe make it simpler?), so that it works with go?
For example, given the string %d%2524e%25f%255E00%%%252611%25
, it should match the first %
and the first two ones of the %%%
substring.