Start a new topic

RegEx to blank field if it contain certain characters

If a new gift membership buyer buys online, the online sales system automatically gives them a customer number that starts with a C, which if we don't delete it, ends up becoming the buyer's raiser's edge constituent ID, which we don't want.  What regular expression will blank any customer number with a C?  I tried this:


https://omaticsoftware.freshdesk.com/support/discussions/topics/28000006433


but can't get it to work.  Below is what I have in the dictionary.


image



Michael, try using ^.*C.*$ on the right side instead, see screenshot below. Note that this formula will return a blank value if there is a 'C' anywhere in the string, not just the beginning - but I have a different formula for you if that needs to only ignore if it 'starts with C' 


-Allison B.


One more problem, sometimes the customer numbers contain a "-" and I want to blank those out too, can I just add ^.*-.*$ to the dictionary?

Exactly right, Michael!

Great, testing them within the dictionary itself seems to work, next time we get some data to run through it I'll keep an eye on it.


Thanks!

If you just want to strip-out specific characters, keep it simple. The following will remove "C" anywhere in the incoming string. If you add a hyphen as an additional 'value to match on', it will remove all "C"s and hyphens.


Replacement values: --Blank--RegEx

Values to match on: C

Login to post a comment