Amanda asked me to help with that regex so it's probably best if I explain it.
Value to match on: (?(.*a.*)b|c)
I just created a Regular Expression that is related to this one, so I thought I would post it:
I needed to populate Marital Status on the primary constituent's record during the import but I did not have a column for this value in my data file. Since the file is a mix of married and single people, I couldn't simply apply a Static Field to handle Marital Status. I didn't want to split my file and do a two pass import, nor did I want to add the column to my data file.
I decided to use a Virtual Field with the Copy Field function and the Seed = Column containing Individual Relationship Last Name, for Marital Status. I then attached the below RegEx dictionary to get the desired values.
Dictionary:
Two entries.
Turn on "Use Regular Expressions" for both Replacement Values.
#1 Replacement Value = Single
#1 Value To Match On = ^\s*$
#2 Replacement Value = Married
#2 Value To Match On = ^\S+$
The layman's terms of what the RegEx is doing:
If the field is BLANK then translate to Single.
If the field is NOT BLANK, regardless of the value, then translate it to Married.
Hope someone finds this useful!
Tiffany
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)$ | |
|
...CONTINUE LIST... |
|
|
$2 | ^(VALID|.*)(.*) |
make sure to click "use regular expressions"
Explained
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!
Wayne Pozzar
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