Regular Expressions Part VI: OR/
October 4, 2006
This is the sixth installment of my Regular Expression lessons. I am actually learning more than teaching and just sharing as I go along. These are Regular Expressions for Regular People (c), so all the tech-talk is removed. My motivation for learning RegEx, as they are called, is Google Analytics.
OR gets symbolized by the pipe symbol |. The pipe symbol is on my US keyword just above the Enter Key but for some reason looks like two vertical dashes on the keyword itself. It’s incredibly simple, and even Google Analytics does a fabulous job with its description:
This was a hard one to screw up, although they have done a good job of screwing up other easy Regular Expressions.
Here’s an example. One of the sites that I work with is an engineering education site, and they teach both Statics and Finite Element Analysis (FEA). Some people also refer to the latter as FEM (Finite Element Method). If I were only interested in the statics keyword searches, I would probably want to get references to FEA and Finite Element Analysis and FEM out of the search reports. I could do that easily in GA by going to the little filter box that can be found on each report, making it into a red minus sign (so that I am filtering out) and typing in FEA|Finite|FEM . This has the effect of saying, “Get rid of references to anything that includes FEA OR Finite OR FEM.”
Dollars signs $
Question marks ?
Square brackets and dashes -
Plus signs +
Regular Expressions for Google Analytics: Now let’s Practice
RegEx and Good Greed