regexcsvreplaceremoving-whitespacescite

Using RegExp to find and remove Whitespaces from Phonenumbers in CSV (with Scite if possible)


Yes I know .. there are hundreds of this threads, but I am simply not able to grasp the concept .. Sorry!

So for the start I have a CSV with about 5000 lines and each line has some informations as text and some phonenumbers in the following format -> "+49 511 111111 11"

Now I need to run a search in scite that finds the phonenumbers and strips all whitespaces.

Example part of CSV is as follows:

"25";"10010";"Some Company GmbH & Co. KG";"z.H. some guys name";"Some Street 4";"1";"12345";"city1";"+49 1245 45555 0";;"+49 1245 45555 21";"+49 171 45555888";;"http://www.somebogussite1.de";;;;;"infos freetext"
"26";"10110";"Some Company GmbH & Co. KG";"z.H. some guys name";"Some Street 4";"1";"25487";"city2";"+49 30 1255580";;"+49 30 1111111 25";;;"http://www.somebogussite2.de";;;;;"infos freetext"
"27";"10210";"Some Company GmbH & Co. KG";"z.H. some guys name";"Some Street 4";"1";"22558";"city3";"+49 531 17960";;"+49 531589521";;;"http://www.somebogussite3.de";;;;;"infos freetext"
"28";"10320";"Some Company GmbH & Co. KG";"z.H. some guys name";"Some Street 4";"1";"65478";"city4";"+49 180 16680";"+49 511 8855520";"+49 511 8855521";"+49 511 8855522";;"http://www.somebogussite4.de";;;;;"infos freetext"

so now I did try some stuff on regexr.com and came to this (and about a hundred more ways to mark the string)

(\"\+((\d?)|(\s?))*\")

That finds all phonenumbers, but does not create any groups that I can use to strip the spaces ..

it only gives me the complete number in $1 each after the other ..

Maybe someone could please kick me in the right direction, that I can use scite to replace the whitespaces otherwise I will have the whole weekend full of manual linework in that damn csv .. :/


Solution

  • Search ;"(\+[0-9]+) +([0-9]+) +([0-9]+) *([0-9]*)" and replace it with ;"\1\2\3\4