Regex: Match any character (including whitespace) except a comma

Posted by selecsosi on Stack Overflow See other posts from Stack Overflow or by selecsosi
Published on 2012-11-17T10:55:43Z Indexed on 2012/11/17 11:01 UTC
Read the original article Hit count: 144

Filed under:
|
|

I would like to match any character and any whitespace except comma with regex. Only matching any character except comma gives me:

[^,]*

but I also want to match any whitespace characters, tabs, space, newline, etc. anywhere in the string.

For example, I would like to be able to match all of this up until the comma:

"bla bla bla"
  "asdfasdfasdfasdfasdfasdf"
"asdfasdfasdf",

Is there a simple way to do this without knowing where the whitespace may be?

© Stack Overflow or respective owner

Related posts about regex

Related posts about string