Reputation: 81523
I'm trying to match any space
and comma
combination as long as it contains at least 1 comma
Test case
"aaa,bbb ccc ,, ddd ,, ,, , eee,"
Results
"aaa
,
bbb ccc,,
ddd,, ,, ,
eee,
"
What i have
[\s,]+(?!,)
However this selects spaces without commas
Upvotes: 1
Views: 58
Reputation: 10360
Try this regex:
[, ]*,[, ]*
Explanation:
[, ]*
- matches 0+ occurrences of either a space or a ,
,
- matches single occurrence of a ,
[, ]*
- matches 0+ occurrences of either a space or a ,
Upvotes: 4