in reply to Regex help \b & \Q

\Q\b doesn't work, because it returns \\b (you can verify it by print quotemeta '\b'). You can switch the order to make it work: \b\Q$kw\E\b .

There's another problem, though. \b matches word bounderies, but .NET is not considered a word: the dot is not a word character. Therefore, \b doesn't match at the beginning of '.NET'. Use look-around assertions with whitespace (if your words are delimited by whitespace).

($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Replies are listed 'Best First'.
Re^2: Regex help \b & \Q
by Anonymous Monk on Apr 14, 2016 at 10:35 UTC

    Thanks Choroba for the quick reply.
    Any work around for this?

    I want to match exactly the same $kw in the $title and at the same time want to treat the certain regex characters (like +) as a normal character when matching.
    (The case of $kw = 'C++';)