How to use regex to remove a character

Hi.

I'm trying to clean the results produced by web scraper.

I have a field with this result: 15,279 and I want to clean the , character and obtain 15279

But I have no idea how to use the regex.replace expresion.

Can somebody help me?

Everything you need to know about regex (cheatsheets, examples, etc.) can be found here: https://regexr.com/

I know how to use RegEx, but regex finds strings. I need to replace.

Not sure if you got your answer, but if not, this might help. It looks like the regex in here is match only, not regex replace. So you'd want to match on the values you want to keep. I had something similar where I wanted to take strings like "#25" and "#4" and receive them as "25" and "4" so in my case just using "\d+" was the proper regex for me. What did not work for me was something more fully formed like "s/#//g" where it would substitute out the "#" from the string and retain what was left. It'll be trickier for you with the comma being in the middle of the string. Hope that helps a little.

1 Like