Hi everyone!
I am currently experiencing problems with Regex formula.
I want to remove the symbols :*][/\? and I am using the formula since the Data Cleansing tool seems blocking my app.
Currently the formula looks like this:
regex_replace([#1],"\s","") AND
regex_replace([#1],"\","") AND
regex_replace([#1],"/","") AND
regex_replace([#1],":","") AND
regex_replace([#1],"?","") AND
regex_replace([#1],"*","") AND
regex_replace([#1],"[","") AND
regex_replace([#1],"]","")
The problem is that it is not removing the characters but substituting the whole string with two 0.
Do you know how to solve this?
Many thanks!
Solved! Go to Solution.
REGEX_REPLACE([Field],'[[:punct:]]','')
Should do the job (note this is all punctuation), is this what you want? I ripped this directly out of the data cleansing tool as it it as a macro.
Ben
regex_replace([_CurrentField_],"\s|\\|/|\:|\?|\*|\[|\]","")
will also work. | acts as an 'or'
and you must escape special characters with a \ in regex.
You're running into issues because several of the characters you're trying to replace are special characters. In addition to escaping the space (\s), you should escape the other special characters:
\[
\*
\\
\?
Another option:
REGEX_Replace([Field1], '[\:\*\]\[/\\\?]', '')
It worked! Many thanks for the explanation