Start a new topic

RegEx for Dictionary

We are using ImportOMatic for Raisers Edge.


I need 2 values in my dictionary.


ACTUAL DATA IMPORT VALUES:  

1 Corporate Table Sponsor
2 Individual Ticket

I need the following VALUES to be written to the database:

Table
Individual Ticket

What Regular expression would I use to achieve this?


Thanks


Why do you need a regular expression for this instead of two specific dictionary entries?


Replacement Value = Table, Values to match on = 1 Corporate Table Sponsor

Replacement Value = Individual Ticket, Values to match on = 2 Individual Ticket

David is correct. This is just a straight text-replacement so you don't need to use RegEx at all. Add the replacement values (Table, Individual Ticket) in the left box. Select Table and then add 1 Corporate Table Sponsor in the right side box. Then select Individual Ticket on the left and add 2 Individual Ticket to the right side box. Test it and then add it to your import field mapping.

I just realized the numbers in front of the text DO CHANGE.  So I would need a wild card of some sort for the beginning characters

Thank you.  However, I just realized that the numbers in front of the text DO CHANGE.  Therefore, I will need some sort of Wild Card for them.

In that case, you just need the regex expression for "any number of numbers at the start of the line", which is ^[0-9]+


Replacement Value = Table, Values to match on = ^[0-9]+ Corporate Table Sponsor$

Replacement Value = Individual Ticket, Values to match on = ^[0-9]+ Individual Ticket$


That will match values like:

  • 1 Corporate Table Sponsor
  • 2 Corporate Table Sponsor
  • 26 Corporate Table Sponsor
  • 45345645 Corporate Table Sponsor


It won't match

  • Corporate Table Sponsor (doesn't start with any numbers)
  • 1,200 Corporate Table Sponsor (the comma isn't a number)
  • 2 Corporate Table Sponsors (there's an extra "s" at the end)

If you want it to match that last value, you just need to leave off the "$", which is what tells regex to look for the end of the line.

You could use \d instead of [0-9], but I think the latter is a bit more intuitive.

Google's pretty handy for this: it also returns web sites where you can test what values match against a given regex expression, such as https://www.regextester.com/95029

Thank you!

Login to post a comment