tags:

views:

25

answers:

3

Hi,

I need some Regex help.

I've got a series of numbers. For example: 2010 95 34% 22 55%

I use this Regex to put add quotation marks and commas:

([\d.]+%?)

'$1',

It works great. But, I need to strip the % sign. How do I edit the above Regex to do so?

Thank you!

-Laxmidi

+1  A: 

This RE: ([\d.]+)%? What language are you using?

Lekensteyn
Hi Lekensteyn, Thanks for the message. I'm using Dreamweaver as a text editor. And then sticking the data with quotation marks and commas added into a mySQL database.
Laxmidi
+2  A: 

Try

([\d.]+)%?

With the same replacement:

'$1',
NullUserException
+2  A: 

You just need to move the % outside the capturing group, so that it's not included in the value that's used for $1 in the replacement...

([\d.]+)%?
stevemegson