in reply to \G and regexes

The second TGA will match here:
TGA CAT GAC ^ ^^
Because without /G, it will not start matching with three characters steps from the last match.

Replies are listed 'Best First'.
Re^2: \G and regexes
by 7stud (Deacon) on Apr 05, 2010 at 20:26 UTC
    I know that. The question is why.
      Because the \w\w\w part will match ACA and TGA will match TGA. The regexp does not specify the matching cannot start anywhere in the string, and that's what /G does.
        I'm sorry, I haven't looked at the example again. The \w\w\w part does not match anything in the second case because of *.