 |
Neo2121 Beginner
Joined: 28 Dec 2006 Posts: 12
|
Posted: Tue Jan 22, 2008 2:34 pm
trig matching multiple times per line |
got something like this:
A sharp-toothed gremlin#209277, a chaos orb#233372.
can be more than two or just one entry. What I'm trying to do is grab the <name>#<number> in a db variable
Got this pattern:
problem is it only matches once per line.. only grabbing the first occurance.. How can I make it grab all of them? |
|
|
 |
Fang Xianfu GURU

Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Tue Jan 22, 2008 6:02 pm |
Use a regex:
^(?:[^\#]+\#\d+[,\.]\s*)+$
Should match the line no matter how many examples are on it. You'll need to do some post-processing with the %replace function to get the names and numbers out (I did experiment with bracket-capturing in the regex but couldn't find a way that worked consistently), but that'll match the line properly. |
|
|
 |
|
|