Here is my environment:
Win32 + AS perl v5.8.7 build 813

Example code:

`my $flip = 'vh';
if( $flip =~/v|y/i ){ print "i only -> flip v|y\n"; }
if( $flip =~/h|x/i ){ print "i only -> flip h|x\n"; }
if( $flip =~/v|y/ig ){ print "ig -> flip v|y\n"; }
if( $flip =~/h|x/ig ){ print "ig -> flip h|x\n"; }
if( $flip =~/v|y/g ){ print "g only -> flip v|y\n"; }
if( $flip =~/h|x/g ){ print "g only -> flip h|x\n"; }
#change $flip
print "----------------------\n\$flip is now $flip\n------------------
+----\n";
$flip = 'hv';
if( $flip =~/v|y/i ){ print "i only -> flip v|y\n"; }
if( $flip =~/h|x/i ){ print "i only -> flip h|x\n"; }
if( $flip =~/v|y/ig ){ print "ig -> flip v|y\n"; }
if( $flip =~/h|x/ig ){ print "ig -> flip h|x\n"; }
if( $flip =~/v|y/g ){ print "g only -> flip v|y\n"; }
if( $flip =~/h|x/g ){ print "g only -> flip h|x\n"; }
`

Output with comments:

`i only -> flip v|y (expected this)
i only -> flip h|x (expected this)
ig -> flip v|y (expected this)
ig -> flip h|x (expected this)
g only -> flip h|x (expected this)
<--- didn't match v
----------------------
$flip is now vh
----------------------
i only -> flip v|y (expected this)
i only -> flip h|x (expected this)
ig -> flip v|y (expected this)
<--- didn't match h
g only -> flip v|y (expected this)
<---- didn't match h
`

I was expecting all of these cases to work. But I get odd behavior when I use the 'g' switch in my regex when I switch the string around. Is this a bug? or can someone fill an obvious gap in my understanding of using the g switch in a regex? I didn't know that separate if statements could do this.

Thanks,

JamesNC

Comment onOdd regex results with g switchSelectorDownloadCode