tags:

views:

57

answers:

3

Hi,

I need help with regex. I'm using Dreamweaver to do so text editing. I need to put quotation marks around each number and separate them by commas. (I'm doing this in order to put the values in my database. In Dreamweaver's Find it's possible to use regexp.

I need a regex that finds each number. For example I have the series:

2010 310 309 99.68% 33.98% 44.98%

How do I grab 2010, 301, 309, 99.68%, etc.? They are tab delimited and some are space delimited. How do I grab a number surrounded by whitespace?

Thank you.

-Laxmidi

A: 

I don't know Dreamweaver's exact syntax, but it should be something like:

[\d.%]+
Matthew Flaschen
Thanks for the help.
Laxmidi
A: 

I don't know if Dreamweaver supports this, but normally you can use \s to symbolize whitespace.

So it will be something like this:

\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+%)\s+(\d+%)\s+(\d+%)

good luck

HGF
A: 

I've looked briefly at Dreamweaver's tutorial, it seems like you can:

Search for:

([\d.]+%?)

And replace with:

"$1", 

NOTE: This will create a trailing comma.

NullUserException
Hi NullUserException,Thanks so much. It worked perfectly.
Laxmidi