-----Original Message-----
From: Andrej Kastrin [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 14, 2005 2:55 AM
To: [email protected]
Subject: Problem with regular expression
Hi all
I have a list of terms and I have to find out, if any one of them occur
in my text. Example:
term is e.g. ABCB1 wich is store in variable $w and my regular
expression is "...if /^TI.*?\s$w\s/m..." .That way I successfully found
ABCB1, but if the therm is parenthesize (e.g. (ABCB1)) then I can't find
nothing.
I modify above expression with "...if /^TI.*?.$w./m...", to match any
character before and behind $w, but problem still persist.
Any suggestion; thanks in advance.
There must be more "business rules" than you are giving us because:
if /$what/ =~ $text will be true if $what is in $text...
So are you looking for an "term" that is e.g. delimited by whitespace...
? What else defines the "term" you are looking for?
perl -e '$text=q{some text to look at};
$what=q{to}; # try $what=q{t};
print qq{Found "$what" in "$text"\n} if $text =~ /$what/;'
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>