in reply to Re: regex matching problem
in thread regex matching problem

("|\-|\'+) # capture at word boundary
This is a mess, not a word boundary. You want it to be followed by spaces and digits, which it matches, so it's going to backtrack from the $ or @, so you could do (^@$+).

actually, that mess seems to be necessary. chaning it to your suggestion breaks the matching.

$1 should be set to '5422' in the test string.

Replies are listed 'Best First'.
Re^3: regex matching problem
by Roy Johnson (Monsignor) on Jan 20, 2004 at 19:00 UTC
    The $ needs to be backslashed, so it isn't parsed as a variable. Then it works. I didn't expect variable interpolation in a character class. Oops.

    The PerlMonk tr/// Advocate
      ah. i'll try it on the upcoming revision of the regex.

      i discovered that "product numbers" in the data files can also look like this: 4444-NC, 3434-43, etc.

      my regex-fu was never that great. it's sure gonna get a workout.