I want to find all instances of ")," to replaced with "), " using regex.
CodePudding user response:
Regex: (\),)([^\s-]) Replace: ), $2
(),) : Will find all the strings ), in your text. You need to escape the ) symbol as the ) symbol is a special character
([^\s-]) : In case you already have the ), a space, you don't want 2 spaces, so we use the ^ not
In this example: hello (world),(regex),(coding), (testing) You will replace the ), after world and regex
REPLACE $2 is needed to keep the first character of the next group/word
You can test it on https://regex101.com/
CodePudding user response:
This work on regexr.com
This is the regex that you want
/(\),)/g