in reply to Re: Regex false match
in thread Regex false match

Many thanks.

Replies are listed 'Best First'.
Re^3: Regex false match
by ikegami (Patriarch) on Dec 19, 2006 at 05:43 UTC

    Grandfather meant \Q..\E, not \Q..\Q.

    if ($line =~ m/\Q$process\E/i) {

    That checks if $process is in $line. You could also use index, which might even be faster.

    if (index(lc($line), lc($process)) >= 0)) {

    If you wanted to check if the two vars are the same, then that should be

    if ($line =~ m/^\Q$process\E\z/i) {

    or

    if (lc($line) eq lc($process)) {