I know it is a dumb question at this point, but I cannot get the Regex Replace to work properly. I need help with phrasing syntax correctly.
I have a string with c/o or C/O in them (= care of). I want to replace them with @. The following regex produces undesirable results. It replaces all o’s and C’s in the string:
: regexReplace($VendorCompanyName$,"[(c/o)|(C/O)]" ,"@" )
So, instead of Province c/o Sam, I get Pr@vince @@@ Sam.
I know it must be an easy fix, but I am lost. Please help!
Hi there @IrynaK,
why using regex and not replace() function from String Manipulation? This should work just fine:
replace($column1$, "c/o" , "@", "i")
Also regarding regex. It is not working cause syntax is written so it replaces every c,o,C,O and / character with @. Think cause of
[ ]. So this one works just fine:
regexReplace($column1$,"c/o|C/O" ,"@" )
or this one with case insensitive identifier up front:
regexReplace($column1$,"(?i)c/o" ,"@" )
Worked like a charm!! So glad you are here helping out, guys!
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.