Testing Regular Expressions

Extracting pieces of text out of larger strings based on patterns, this is what regular expression matching facilitates. It really is great stuff...once you wrap your head around it. Most frequently I use regular expression matching in Python, trying to create categorized datasets by extracting values from long strings of unstructured text to populate a new attribute value in ArcGIS. Today I discovered a new website with extremely useful testing and help documentation for creating regular expressions, RegularExpressions101.

Regular expression matching definitely is not easy to figure out, but it is so incredibly useful. Today, for instance, I had a field with whitewater rapid difficulties always listing a maximum difficulty, but sometimes listing a minimum difficulty and also sometimes listing an outlier difficulty. The values were mixed roman numerals such as III (only maximum value), II-III+ (minimum and maximum) and III-IV(V+) (minimum, maximum and outlier). The minimum, maximum and outliers needed to be placed into their own respective fields so I could filter based on these difficulties. Thankfully, regular expression matching provided the answer with the help of Regular Expressions 101 for getting a working regular expression built.