Hi I am currently getting issues with regexes that use the qr operator. The results with qr are different than without. This is a small sample program to illustrate it
use strict; my $str='Database Administrator'; my $pattern= '(?=^(?:(?!(?:datab|network|system)).)*$).*(?:Adm(?:in(?:i?strat(?:ors?|ion|ive)?)?)?|Clerk\b|Clerical|office)(?:.*?ass.*?|supp|temp|staff|officer?|).*?' ; my $pattern2=qr/$pattern/; $str=~/($pattern)/i; print 'no qr',"\t", $1,"\n"; $str=~/($pattern2)/i; print 'with qr',"\t", $1,"\n"; print 'Pattern without qr',"\t",$pattern,"\n"; print 'Pattern without qr',"\t",$pattern2,"\n"; Explanation of pattern '(?=^(?:(?!(?:datab|network|system)).)*$) - looks for datab|network|system and then negates the match within the entire string .* - winds the match back to start of string (?:Adm(?:in(?:i?strat(?:ors?|ion|ive)?)?)?|Clerk\b|Clerical|office)(?:.*?ass.*?|supp|temp|staff|officer?|).*?' - looks for match In this example the phrase "Database Administrator" fails the regex without qr (as it should), but if I use qr it passes giving wrong result this is the output of of the last two lines Pattern without qr (?=^(?:(?!(?:datab|network|system)).)*$).*(?:Adm(?:in(?:i?strat(?:ors?|ion|ive)?)?)?|Clerk\b|Clerical|office)(?:.*?ass.*?|supp|temp|staff|officer?|).*? Pattern without qr (?^:(?=^(?:(?!(?:datab|network|system)).)*$).*(?:Adm(?:in(?:i?strat(?:ors?|ion|ive)?)?)?|Clerk\b|Clerical|office)(?:.*?ass.*?|supp|temp|staff|officer?|).*?) The only difference I can see is the addition of a non-capturing group around the expression (?^:) Anyone any idea what is happening here -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org For additional commands, e-mail: beginners-h...@perl.org http://learn.perl.org/