Closed Maleeha closed 4 years ago
Escape the escape.
In other words, use two backslashes: (\\d)(?=(\\d{3})+(?!\\d))
and \\1
.
But those lookarounds are tricky. I think there are some of themm that aren't fully supported in R. Maybe negative look behinds?
Thank you. I did escape what i needed to escape but as you said it was perhaps not supported by R. I will look into negative look behind.
I saw this as we were just talking about regexes & SCUG issues. If anyone is coming back to it...
make sure perl = TRUE
is specified as an argument to sub()
or gsub()
. I think it's necessary for look-arounds.
I want to put comma in currency:
The following regular expression with positive look ahead and negative look ahead, was working on regex 101
You replace it with:
However its not working for me on R. Any suggestions? @wibeasley
Thanks!