Re: Grep question

[email protected] ("John W. Krahn")
Newsgroups perl.beginners
Message-ID <[email protected]>
Steve Bertrand wrote:
> David Gilden wrote:
>> Could someone please help me the syntax here....
>>
>>
>> my $Comments = param('(Comments');
>> &BADemail if ($Comments =~ /[virtualthirst.com|napavalleycf.org]/ig);
>>
>> This should go to  &BADemail if $Comments contains either string, 
>> regardless else is contained in the $Comments.
> 
> In a response I received on this thread:
> 
> http://www.nntp.perl.org/group/perl.beginners/2008/06/msg101141.html
> 
> ...in particular, I learned from John that:
> 
> "The '|' which is used for alternation outside of a character class just 
> matches a literal '|' character inside a character class...."

Also duplicate characters are ignored so the character class 
[.acefghilmnoprstuvy|] matches the same character (and only one 
character) as the character class [virtualthirst.com|napavalleycf.org]


John
-- 
Perl isn't a toolbox, but a small machine shop where you
can special-order certain sorts of tools at low cost and
in short order.                            -- Larry Wall
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.