|Tags||.lookup, .replace, 4CKMEl, 4Cs of Knowledge Management and Exchange, Awk, Grep, Regex, Regular Expression, RunCommand, Stamps, Tinderbox, aTbRef|
|Example File||TBX- L Using Regex and Replace to Parse patterns [like emails].tbx (354.2 KB)|
In this lesson, I provide a high-level overview of how to use regular expression (regex), a fundamental pattern matching capability in Unix computers, within Tinderbox. I demonstrate how you can use regex to 1) perform a search in Tinderbox, 2) to find and replace strings of text in $Text and populate user-generated attributes, 3) to create lookup lists from strings found in $Text, and 4) to parse $Text using grep and awk command line code. Specifically, in the use case I go through, I explain how I’m looking to parse full names and email addresses from $Text to populate user-generated attributes. I show three methods for doing this: .replace, .replace and lookup, and runCommand action code. I also include a slew of definitions and references.
NOTE: to run the command line stamps in this training I have Home Brew installed (Pandoc - Installing pandoc) along with gwak (awk gawk Man Page - Linux - SS64.com) and grep (grep Man Page - Linux - SS64.com), to command line apps. If the method three stamps don’t work for you, the reason why is your awk and grep command line code is not up to date. We can get help from the community to help upgrade your system.