in reply to regex matching problem
No, that's matching digits./([\d]+) # match first nonspace ( greedy )
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 ([^@\$]+) (update: backslashed $).([\w\s|"|\-|\']+) # capture at word boundary
Should be written \s{2,}, but ok.\s\s+ # single space followed by multiple spaces
Any number of them, in any order.([\d,\.]+) # capture digit, comma, period
correct, but better as \s\D+\s[^\d]+ # single space, non-digit character
Are the strings you're using in your test case the same strings that fail in the actual program?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: regex matching problem
by geektron (Curate) on Jan 20, 2004 at 18:01 UTC | |
|
Re: Re: regex matching problem
by geektron (Curate) on Jan 20, 2004 at 18:19 UTC | |
by Roy Johnson (Monsignor) on Jan 20, 2004 at 19:00 UTC | |
by geektron (Curate) on Jan 20, 2004 at 21:17 UTC |