Start a new topic

Dictionary "anything else"

I would like a dictionary that replaces one specific string with another, but any other string should be replaced by -BLANK-.  I think this is easy but I can't figure it out!

RD101 -> recurring

-> -BLANK-

1 person has this question

I wasn't 100% sure of what the outcome would be in that scenario, so I tested it and it doesn't work.  The dictionary will not blank out the already populated date value.  I see that you are currently in communication with our support team regarding the pricing and implementation of the customization, so please let them know if you'd like to move forward with that.



1 person likes this
Doug, welcome to the forums!

If you are just looking to say: "If there is something in the field then make it 'Blah Alumnus' but if it is blank then leave it blank"

could you just do:
Replacement: Blah Alumnus
Value to Match: .+

Then it you match any characters and replace it with the string, or match no characters and just leave it blank.
I'm trying to set up a dictionary with several values. If the text in the field does not match any of the values, then it should say "General".
Some of the values have spaces, and some do not. I tried Tiffany's expression, but it does not work if there are spaces.
Can someone help me figure this out?
Hi Marie,

This was a fun one!

Assume that I want to replace everything but "one" and "two words" with a blank

Replacement Value  Value to Match
 VALID$1 ^(one)$
  ^(two words)$


$2 ^(VALID|.*)(.*) 

make sure to click "use regular expressions"


The first part VALID$1 and ^(one)$ will add "VALID" to the beginning of a value that matches "one".
So after step 1 the value is now VALIDone.  This is repeated for all of the values that you enter in here making sure to enclose the whole value in parentheses. 

The second part $2 and ^(VALID|.*)(.) will put either VALID or .* (the whole string) into $1 and then what is left over in $2.  The key here is that if the string does not start with "VALID" then all of the string goes into $1.  Only if the string starts with "VALID" will there be anything left over in $2.
After step 2 the value is now back to one since it had been appended a VALID in step 1.  If you try to type "two" then that will not get a VALID from step 1 and so will be blank after step 2

Give it a shot!

Thanks Wayne ! I'm still not clear on it though.
This is a sample of my data:
Workplace Giving
Miracle Jeans Day Holiday Edition 2013
Icon Campaign

If the value is "Miracle Jeans Day Holiday Edition 2013" I want to replace it with "Miracle Jeans". If the value is anything else, I want to replace it with "General".
ohh, I didn't realize that you wanted to replace the valid values with something else. My solution just keeps them the same but blanks out any that don't match.

How many are you trying to match?

You could still use this technique by doing something like:
Replacement Value1: VALIDMiracle Jeans
Value to Match1: Miracle Jeans Day Holiday Edition 2013

Replacement Value 2: $2
Value to Match 1: ^(VALID|.*)(.*)

Thanks, Tiffany! That's exactly what I came looking for! Doing the same thing with marital status and checking the spouse checkbox!
Hi Wayne,

In your dictionary you'll have these two entries:

Replacement Value 1: recurring
Value to match on 1: RD101
Regex OFF

Replacement Value 2: --BLANK--
Value to match on 2: \b(?(\brecurring\b)MATCHED|.*)\b
Regex ON

Please let me know if you have any questions!

Omatic Support
I have come across another way to get the elusive "match anything except X" to work by using the negative lookahead function.

The expression looks like:^(?!(regex)$).* where regex  is any valid regular expression.

For example, if you wanted to make anything that was not "Male" or "Female" become "Unknown" you can use:
Replacement Value: Unknown
Value to Match: ^(?!(Male|Female)$).*

Or, to recreate my original request in this thread I could do
Replacement Value1: recurring
Value to Match1: RD100

Replacement Value2: -BLANK-
Value to Match2: ^(?!(recurring)$).*
Well, that worked, but can you explain what is happening in that regular expression?

HI there,

Can I do something like that, but using a field from the fields mapping as the value to be replaced?


If gift aid = yes ==> add the date from imported spreadsheet on column C

If gift aid = no ==> skip and leave it blank

I can't see how to do that using a dictionary and if I don't use one, it adds the date to all the records!

Many thanks,


I had an issue where I was adding an education relationship in most cases, but some of the people in the input file did not have the school specified. If the school was there, I wanted the status to fill in with a certain text, but if the school was not there, status should be blank. I ended up creating a Dictionary entry with the Replacement value being my "Blah Alumnus" string and the values to match on being the RegEx expression below. This matches anything with or without spaces.


^ anchors the search at the start of the string.

(?!\s*$), a so-called positive lookahead, asserts that it's impossible to match only whitespace characters until the end of the string.

.+ will then actually do the match. It will match anything (except newline) up to the end of the string.
Hi Wayne,

Amanda asked me to help with that regex so it's probably best if I explain it.

The first set is pretty clear. Just replacing the RD101 to recurring.

The second set can be confusing but what is really going on here is a regex IF statement. It works like this:


If the expression matches then used the regex expression in the yes area, otherwise use the no area. In your case we are matching on "recurring" as our expression, and if it matches, then use MATCHED as the expression to replace against (MATCHED is unlikely to actually match anything in your column so I figured it was a good expression to use). So whats happening is every entry that doesn't contain "recurring" is getting the .* expression (.* is any character zero or more times, essentially any value) and being replaced with blank.

If the text to compare contains "recurring" then it would try to replace the expression "MATCHED" with blank. I chose "MATCHED" because that is unlikely, you can change it to some other unlikely to match expression.

If the text to compare does not contain "recurring" then it would try to replace the expression ".*" with blank.

Here's a simple example:
Replacement Value: #

Value to match on: (?(.*a.*)b|c)

Text to test against: banana
Result: #anana
"b" is replaced in banana because banana contains "a"

Text to test against: cup
Result: #up
"c" is replaced in cup because cup doesn't contain "a"
Login or Signup to post a comment