PDA

View Full Version : Regular Expressions


jstrike
Oct 11, 2007, 10:18 AM
I use a program called The Regex Coach (C:\Program Files\The Regex Coach\doc\index.html) which usually allows me to hack out regex expressions but I'm having a tough time with this one.

Here's the line... I have about 50-60K of these to parse in each file and 3 files total.

Diesel,None,None,None,DTH,6,"00,111",4,No,0.92811,"33,321.00", YES ,"7,876","8,343",350,Sullivan,Yes/No,444,CAT C18,Caterpillar,30,0,6,4,30,HR,33,33HR

The person that wrote the initial parser went through the line character by character and it takes forever to read the file in, I need to speed this up. I need a regular expression that will allow me to find the parts in the double qutoes so I can change them and properly split the line into an array. For the above line I would need to be able to find:
"00,111"
"33,321.00"
"7,876"
"8,343"
Once I've found the string, changing it is trival... I just can't seem to figure out the regular expression.

Any help is greatly apprecaited,
-Jeff

jstrike
Oct 11, 2007, 01:48 PM
"\d+,{1}[\d.]*" appears to work. I got the answer just in time to have this project side tracked.