Question

I am hoping someone might be able to help me with this. I am using textpad and need to remove commas that appear in customer addresses with whitespaces

For example

123, testville, tesland,

abc, testtown,

I tried the following in the Replace function in Textpad: [a-z],\s+ and in the above examples it would find and select e, and d, and c, and n,

What should one enter in order to find and select the comma only in those examples (instead of selecting the preceding letter also)

Also how would you select either a number OR a letter preceded by a comma. The number could be three digits.

Gratitude for any suggestions.

Was it helpful?

Solution

You can try this regex for find:

([a-z0-9]),\s+

And replace with:

\1 

(Read as backslash, 1 then space)

The parens in the find expression are used to store the part that match, so that you can access them in the replace. For instance, the first capture will be in \1 (if they are more, you use \2, \3, etc in the order of the capture).

That way, even if the preceding letter or number matches, you're replacing it back.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top