On 25 Jun 2001 09:41:58 +0100, Govinderjit Dhinsa wrote:
> One question please, I want to search for M and A, at the moment I am
> only searching for M (as below)
> if ($fields[14] =~ /M/)
>
> Would the example below be correct please;
> if ($fields[14] =~ /\M\|\A\/)
>
>
> Your help is much APPRECIATED
>
> > Kind Regards,
> > GD
> >
>
Are you looking for M _and_ A or M _or_ A. This is important as
#works for whole words M and A (ie /This|That/)
if ($fields[14] =~ /M|A/)
and
#works for characters only
if ($fields[14] =~ /[MA]/)
will match for all of the following strings
"Make this match"
"As I was saying: Make this match"
"Correct, A+!"
If you want to only match The middle string (the one with both A and M)
you need to use a regexp like this:
if ($fields[14] =~ /M/ and $fields[14] ~= /A/)
--
Today is Sweetmorn, the 30th day of Confusion in the YOLD 3167
Grudnuk demand sustenance!