Have to do lots of regex matching for string, these three websites are great if you are stuck.
https://jsconsole.com/
https://rubular.com/ can show others your regex: https://rubular.com/r/QEcbDCJSDCiBMb
https://regexr.com/
https://rubular.com/ can show others your regex: https://rubular.com/r/QEcbDCJSDCiBMb
https://regexr.com/
jsconsole.com
"covid-19".replaceAll(/([a-zA-Z]+)-([0-9]+)/g, "$1 $2")
covid 19
"my number is 1234543 234k-kk1-234 234k23412kj531-24 and 12.3.4.5643.3 and 123.456".replaceAll(/([0-9]+([^-][0-9]+)?)/g, " $1 ")
my number is 1234543 234 k-kk 1 - 234 234 k 23412 kj 531 - 24 and 12.3 . 4.5643 . 3 and 123.456
"abc(123)".replaceAll(/\(.+\)/g, '')
abc
"PTive test to try. had'PT testing caPTive PT and PT.".replaceAll(/(([^'])(\bPT\.|\bPT\b))|(^\bPT\.|^\bPT\b)/g, ' p t ')
PTive test to try. had'PT testing caPTive p t and p t
rubular.com
Also can share regex with others using permalink, try it: https://rubular.com/r/QEcbDCJSDCiBMb
regexr.com
Comments
Post a Comment