Regular expressions
Regular expressions extract useful pieces of information from strings using matching patterns. They provide robust matching, parsing, or replacement of string data. The Match output is a Boolean value of true
and false
. True
if the string pattern matches the regular expression and false
if it doesn't. The Parse output returns the groups specified in the regular expression. The Replace output can replace groups specified in the replacement text window. The RegEx tool contains these powerful extraction pieces to obtain important information from strings. Let's go through an example of how versatile regular expressions can be. We will continue using the U.S. Chronic Disease Indicators workflow from the previous section, along with the resources located in the data folder.
Regular Expressions Example #1: Parse the QuestionID
field to identify if a match is found containing one digit after the underscore _
punctuation.
Step 1: Select the RegEx tool from the Parse tool palette...