in reply to \G and regexes
XTGAXX would be a valid match for /(\w\w\w)*?TGA/ The simple solution is to anchor that pattern to the start of the string:
The down side is the potential to be very slow depending on how the regex engine handles the global match./^(\w\w\w)*?TGA/g
\G forces the next match to start after the previous one, preventing any expensive backtracking.
--Greg
|
|---|