"[EMAIL PROTECTED]" wrote:

> i don't know what \G is :)

If the smiley face means you're kidding,
read no further.

If you don't know what \G is, then here we go:

\G is a positional anchor in regular expressions.
it is similar in function to 
        ^ meaning start of string
        $ meaning end of string

\G means "the position where teh last regular
expression on this string finished.
The \G anchor is tied with the /g modifier,
so you usually use them together.

$str = 'hello';
$str =~ /h/g;
$str =~ /\G(.)/g;
print $1;

this will print 'e'

the second regexp will start where the last
one left off. (after the 'h')
therefore the . matches the e.

you can get and set the position of the \G
anchor by calling the pos($str) function.

it will return the numeric index from the 
start of the string to the \G anchor.

pos($str) = 3;

This ^ will move the \G marker to position 3.

This is used heavily by Parse::Nibbler.pm

Greg

Reply via email to