Reference - Regular Expressions

TSL Ping Tree > Reference

Reference - Regular Expressions

TSL Ping Tree allows you to use regular expressions to perform string matches in many places in the system.  Regular expressions are very powerful but unfortunately they are complicated.


Here are some examples:

   ^(na|n/a|no answer|not applicable)$     matches the whole strings "na", "n/a", "no answer" and "not applicable"

   ^(A[KLRZ]|C[AOT]|D[CE]|FL|GA|HI|I[ADLN]|K[SY]|LA|M[ADEINOST]|N[CDEHJMVY]|O[HKR]|PA|RI|S[CD]|T[NX]|UT|V[AT]|W[AIVY])$     the 50 US States plus DC for District of Columbia

   ^(\d{5}(-\d{4})?)$     a valid US ZIP Code where the "+4" part is optional

Following are some resources for you to read to learn more about regular expressions.  Note: The ping tree part of our system is coded in Microsoft .NET and so our regular expression engine is also .NET.

   http://www.regular-expressions.info/tutorial.html - a brief tutorial for how to express common match rules

   http://regexlib.com/CheatSheet.aspx - a quick reference of match symbols if you already have familiarity with regular expressions in Microsoft .NET

Here are some tools that are very helpful to use when working with regular expressions.  Pricing is as of Summer 2012.

   http://regexhero.net/tester/ - RegEx Hero - online shareware that's free to use but $10 USD to buy;  $20 USD gets you a companion Windows desktop version

   http://www.regexbuddy.com/ - RegexBuddy - Windows desktop software, costs $39.95 USD