I'll admit it: regexes are NOT my best subject.  I have written very, very simple ones before, but I really prefer to find them already written that I can repurpose, because I just don't think I'm good at writing them.  They seem deceptively simple, but I've been in support long enough to realize that writing a good one may possibly be an art.  I audit a fair number of service requests in a month, and I was seeing a trend so I decided to share some generalizations about using regexes in MEG.  If you're not familiar with what a regex even is, then I will quote Wikipedia and define it as a "sequence of characters that forms a search pattern, mainly for use in pattern matching with strings, or string matching, i.e. "find and replace"-like operations".


Anyway, frequently I see where someone has decided to use a regex in a dictionary in MEG's compliance area.  And  I also see where folks have attempted to write one to match a US Social Security number (SSN) and it's not turning out quite the way they would like.  Engineering has included one on the box already, but since it's under the 'Language N/A' section, it's possibly going unnoticed amongst the plethora of prebuilt regexes in that section designed to hit on identification numbers of all kinds.  These selections don't shout to the rafters that they are regexes, but under the hood, that's exactly what they are.  So, my advice would be just to use one of the prebuilt ones if at all possible.


Assuming that  you can't find a prebuilt one that does what you want, and you decide to write one, and it doesn't behave exactly the way you expected, you're going to be tempted to call support and see if we can help you with it.  While support cannot write it for you, we are happy to show you where to enter it in the UI, and we can often help you determine whether there is a better way to accomplish what you are attempting.


In upcoming releases, I think we will see even more possibilities for using regular expressions emerging in other sections of the product besides just in the compliance dictionaries, so the topic might be coming up more often.  Because of that, I asked MEG's engineering team if they had a primer they swore by when they wrote regexes, and they did.  They recommended http://perldoc.perl.org/perlrequick.html and http://perldoc.perl.org/perlretut.html as references to get started and/or become more proficient at writing regular expressions.  If this is something you need to write to accomplish your objective, I second engineering's recommendation to start with these links, and get started "expressing" yourself.