Reputation: 2684
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
Upvotes: 2
Views: 1481
Reputation: 85468
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.
Upvotes: 1
Reputation: 575
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
Upvotes: 0
Reputation: 284927
I don't know Dreamweaver's exact syntax, but it should be something like:
[\d.%]+
Upvotes: 0