Suppose I have the following string:
abc,400,00,foo,bar,34,000,,hello,bye
What would the proper regex be to match the number of commas that have a character both on the left and right side though both characters can't be numeric, and non can be other commas.
In the example string, the commas I placed inside the parentheses would be counted, the rest not.
abc(,)400,00(,)foo(,)bar(,)34,000,,hello(,)by
CodePudding user response:
You can match ,
between word characters by use of
You can user OR in your regex with two possible cases
CodePudding user response:
This should also work -
(?<=[^\d,]),