go ahead... be a heretic | |
PerlMonks |
Re: Re: reversing a compiled regex?by MarkM (Curate) |
on Mar 27, 2003 at 02:30 UTC ( [id://246145]=note: print w/replies, xml ) | Need Help?? |
This is not a correct conclusion or suggestion. Take a look at your code again: my $regexs = qr/[^\Q$str\E]/i;[] is used to define a character class, not a regular expression grouping. The statement above reads: "at least one character not found in $str." The reason your test code did not show you this is because you were matching: ($a = "SCALAR") =~ s/[^TT]/HOO/gi;Or, simplified: ($a = "SCALAR") =~ s/[^T]/HOO/gi;Since every character in the string "SCALAR" is "not T", every character is replaced with HOO. The original request was for a method of implementing !// using only //. Please put a little more thought into your response... Cheers...
In Section
Seekers of Perl Wisdom
|
|