Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

Hi People! Had a quick question :-D I'm doing a reg exp to see whether a '(I)' exists in a statement .... I use
my @tt = $temp =~ m/(I)/;
Thing is that it returns true if the statement is '(ENRICHED)' i.e. the 'I' is present inside the brackets but so is some other stuff. BUT I only want a true if the statement has '(I)' ... what tag am I missing? Thanks guys, S

Replies are listed 'Best First'.
Re: Reg Ex simple query ......
by adrianh (Chancellor) on Jan 04, 2003 at 20:27 UTC

    ( and ) are used in perl regular expressions for grouping. You need to escape them like this:

    $temp =~ m/\(I\)/;

    See perlre for details.

      Ligggghtttttniiingggg fast reply! Thanks, it worked :-D. Appreciate it.