in reply to Re: converting an arbitrary string into a hash based on a pattern
in thread converting an arbitrary string into a hash based on a pattern

Hi Holli,

Let me know the meaning of \G.

  • Comment on Re^2: converting an arbitrary string into a hash based on a pattern
  • Download Code

Replies are listed 'Best First'.
Re^3: converting an arbitrary string into a hash based on a pattern
by lidden (Curate) on Mar 04, 2005 at 05:00 UTC
    From "perldoc perlre"
    \G Match only at pos() (e.g. at the end-of-match position of prior m//g) [snip] The "\G" assertion can be used to chain global matches (using " +m//g"), as described in "Regexp Quote-Like Operators" in perlop. It is + also useful when writing "lex"-like scanners, when you have several +patterns that you want to match against consequent substrings of your st +ring, see the previous reference. The actual location where "\G" wil +l match can also be influenced by using "pos()" as an lvalue: see "pos" + in perlfunc. Currently "\G" is only fully supported when anchored +to the start of the pattern; while it is permitted to use it elsewhere +, as in "/(?<=\G..)./g", some such uses ("/.\G/g", for example) current +ly cause problems, and it is recommended that you avoid such usage for n +ow.