Jump to content

SOLVED: Help with a reg exp


aspnetguy
 Share

Recommended Posts

I have a string that I need to split with a Regular expression.The sample string would be like this:

4533,"this is a descrption with a , in it"
I need to split by comma (,) but not if the comma is within double quotes (")Something like /[^(".*,.*")]/ will not match commas in double quotes but I don't know how to get it to also match commas outside double quotes.Thanks.
Link to comment
Share on other sites

How about

 /[^(".*,.*")],/

Just to be clear, what the environment? JavaScript? I'm asking because I've seen two ways to make a negative match. One is that way, and the other was something like

(!?,)

(in that sample, the regex matches anything but any comma)

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...