Regular Expression trouble.

Enameless

New member
I am attempting to create a regular expression so that I can grab the 3 1-2 digit numbers from a string set-up as "D1= XX , D2= XX , D3= XX ," with the XX representing the numbers I want. Now from a previous regular expression I used I know \b(\d+) (\d+) (\d+)\b will grab said numbers if setup as XX XX XX. So I think my troubles stems from how to eliminate the "D1=" and ",". I've been using RegExPlanet to test my attempts and have tried many different ones which I can post if needed. Thanks for any help\advice

Enameless
 

jasonharper

Developer
Well, if it's always in exactly that format, then "D1= (\d+) , D2= (\d+) , D3= (\d+)" would work. You might want to replace all the spaces with "\s*" so they'll match any amount of whitespace (including none).
 

Enameless

New member
Thank you thank one did work for me though it was throwing in the D1= part in with the grouping. I got stumped again but then ended up setting it up so each part was grouped then just used the parts I needed. I'm loving and hating regex right now. It makes these fairly easy once you figure out what you need but figuring it out makes my head spin.
 
Top