[EMAIL PROTECTED] wrote:
> I am trying to do write a search comparison between to
> part numbers....
>
> $found = 1 if $string1 =~ /$string2/g;
>
If there can be reqex operators within the variable then you need to tell
regex to not expand, so you would do something like:
$found = 1 if $string1 =~ /\Q$string2\E/g;
Now when it finds an * it is just coig to use as an asterick and not one or
more occurances of the preceding character(s).
Wags ;)
> I want to know if $string2 occurs within $string1.
>
> Basic enough ... however, I am finding that at times
> $string2 contains characters such as: ** and (+ABC
> etc.
> and this is giving errors in the REGEX such as
>
> Quantifier follows nothing before HERE mark in regex
>
> because these characters throw off the regex...
>
> I could write a cleanup routine to strip out
> characters like this so that $string2 never contains
> them -- but I wanted to know if there is something I
> can do within the REGEX itself to tell it not
> interpret anthing found within $string2 as anything
> other than the characters for the pattern and not some
> special meaning.
>
> I tried using /"$string2"/g and /\'$string2\'/g ...
> this did not work and I believe it may not be on the
> right track...
>
> Thanks for any help...
>
> John
>
>
>
>
> =====
> John V. Pataki
> Logged in to my Yahoo Mail account on the web.
>
**********************************************************
This message contains information that is confidential
and proprietary to FedEx Freight or its affiliates.
It is intended only for the recipient named and for
the express purpose(s) described therein.
Any other use is prohibited.
****************************************************************
_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs