in reply to Re^2: regex trouble
in thread regex trouble

In a regex, "\," is exactly equivalent to "," -- and likewise for colon and angle brackets. Those characters do not have any "magical" force in the regex syntax when used without escapes (in contrast to period, asterisk, square brackets and so on), nor do they have any special meaning when preceded by backslash (in contrast to "n", "t", "b", "d" and so on).

Meanwhile, quotemeta is a more-or-less general-purpose function -- according to the manual, it 'Returns the value of EXPR with all non-"word" characters backslashed. (That is, all characters not matching "/[A-Za-z_0-9]/" will be preceded by a backslash in the returned string, regardless of any locale settings.)'

(updated to fix display of square brackets in last paragraph)

Replies are listed 'Best First'.
Re^4: regex trouble
by dewey (Pilgrim) on May 31, 2007 at 14:37 UTC
    I see. Thanks.

    ~dewey