in reply to Re: help needed to solve in regex
in thread help needed to solve in regex

You forgot the surround the pattern with \b markers.

/\b\Q$find\E\b/

⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊

Replies are listed 'Best First'.
Re^3: help needed to solve in regex
by ikegami (Patriarch) on Jan 10, 2007 at 06:26 UTC
    oh, I didn't notice that matched the third line. Unforunately, I don't agree with your solution. That is to say I don't think we can provide a solution with the information he provided us. For example, all of the following match his criteria, yet all are different:
    • /\b\Q$find\E\b/
    • /(?<!\S)\Q$find\E/(?!\S)
    • /\Q$find\E/(?!\.)
    • /\Q$find\E$/
    • /\Q$find\E$/m
    • /\Q$find\E\z/
    • ...

    The op should have a look at perlre. (Or should I say "another look" since he should already have looked there when he started having problems with his regexp...)