Find, for example in
yyyy , yyyy
yyyy,yyyy
yyyy, yyyy
yyyy ,yyyy
the pattern between yyyy and yyyy.
I've tried:
(\s*,{1}\s*)
but this will also match
yyyy,,yyyy.
Demo
What is missing?
Using lookarounds:
(?<![,\s])\s*,\s*(?![,\s])
(?<![,\s]) is a negative lookbehind (?<!pattern). In this case, "not preceded by a comma or a whitespace"(?![,\s]) is a negative lookahead (?!pattern). In this case, "not followed by a comma or a whitespace"If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With