Start a new topic

Regex to parse interest group values

We are using Luminate Connector and have interest groups mapped to solicit codes. The interest groups are coming over in a string -- eNews,Events,Fundraising -- that the connector is trying to read as a single solicit code rather than three. Anyone have a regex that will parse the interest groups into three solicit codes?

1 Comment

Hi, 


There are a few different ways to accomplish this:


Option 1: 

You will need to create multiple virtual fields - one for each potential interest code that will be returned. Create a dictionary for each individual interest group. The dictionary will look to see if the solicit code is within the string, return that solicit code, or else return a blank value. Here is an example:


Dictionary for Virtual field for eNews Solicit Code:

Value to match on: .*eNews.*

Replacement Value: eNews


Value to match on: ^((?!eNews).)*$

Replacement Value: BLANK


Dictionary for Virtual field for Events Solicit Code:

Value to match on: .*Events.*

Replacement Value: Events


Value to match on: ^((?!Events).)*$

Replacement Value: BLANK


Option 2: 

If an exact list of interest groups isn't a relevant option, here is another approach. You would create multiple Virtual fields- the same number of fields as the potential number of values in the string. Here is an example of the dictionaries under the assumption that there are 3 potential values returned: 


Dictionary for the Virtual field for the first interest code:

Value to match on: $1

Replacement Value

(.*),(.*)


Dictionary for the Virtual field for the second interest code:

Value to match on: ^((?!,).)*$

Replacement Value: BLANK


Value to match on: $2

Replacement Value:

(.*),(.*),(.*)

(.*),(.*)


Dictionary for the Virtual field for the third interest code: 

Value to match on: ^((?!(.*),(.*),(.*)).)*$

Replacement Value: BLANK


Value to match on: $3

Replacement Value:

(.*),(.*),(.*)


Option 3: 

If there are more than 3 potential values coming from Luminate, the first dictionary could stay the same. However, you would need to add a 4th dictionary, and update the 2nd and 3rd dictionaries:


Dictionary for the Virtual field for the second interest code:

Value to match on: ^((?!,).)*$

Replacement Value: BLANK


Value to match on: $2

Replacement Value:

(.*),(.*),(.*),(.*)

(.*),(.*),(.*)

(.*),(.*)


Dictionary for the Virtual field for the third interest code: 

Value to match on: ^((?!(.*),(.*),(.*)).)*$

Replacement Value: BLANK


Value to match on: $3

Replacement Value:

(.*),(.*),(.*),(.*)

(.*),(.*),(.*)


Dictionary for the Virtual field for the fourth interest code: 

Value to match on: ^((?!(.*),(.*),(.*)).)*$

Replacement Value: BLANK


Value to match on: $4

Replacement Value:

(.*),(.*),(.*),(.*)




Best,



Kristen Gajdica

Associate Product Manager

Login or Signup to post a comment