in reply to Regex help

The regex should still "work" when $symbol is a comma. Maybe you should show us some input data, one string where it succeeds and one where it fails, and also the values for $symbol.

Replies are listed 'Best First'.
Re^2: Regex help
by Anonymous Monk on Jan 14, 2006 at 16:28 UTC
    Let's say I've the following:

    $sentence: That is naughty cat.
    $symbol: naugh

    That passes the test but I need it to fail because "naugh" is only part of "naughty".

      Sorry, what I meant to say is: If I removed the two '\b', a partial word and a comma are both matched. But what I need is to match either a comma or a complete word in the given sentence.