using RegEx to replace +(

Trying to clean up an old Filemaker database that has phone/fax numbers in format +(44) 1234 123456. Initially we just want to remove the ‘+’ ‘(’ ‘)’ characters and replace with ’ ’ (space).

Have looked through the Servoy docs CH5 and http://www.regular-expressions.info/javascript.html but just can’t work out how to do this task. Suspect that the ‘(’ and ‘)’ characters are complicating things.

Can one of you smart cookies take pity and point me in the right direction.

Thanks in advance.

Graham Greensall
Worxinfo Ltd

By heart:

.replace(/\+|\(|\)/,"")

Should do it…

Many thanks Marcel

But I think you were just teasing me - as it didn’t really work at first :)

Needed the ‘g’ operator to ensure all instances were processed and not just first one.

For anyone else treading this path - just replace my test variables with your own input:

var vFax = comp_fax
var vFax2 = vFax.replace(/+|(|)/g," ")

Graham Greensall
Worxinfo Ltd

yep, that’s necessary but I really forgot it (that’s why I mentioned it was by heart). All languages seem to have their different .replace methods and associated behaviour :oops: