Chapter 12
Regular Expressions
Regular expressions are a pattern matching standard for string parsing and replacement. The pattern describes one or more strings to match when searching a body of text. The regular expression serves as a template for matching a character pattern to the string being searched.
In its simplest form, a regular expression is a string of symbols to match “as is.”
RegEx | Matches |
---|---|
abc | Abcabcabc |
234 | 12345 |
Here, we can see that regular expressions match the first case found, once, anywhere in the input string. Therefore, what if we want to match several characters? We need to use a quantifier or meta character. The most important quantifiers are *?+.
* matches any number of what is before it, from zero to infinity. ...
Get Agile Automation and Unified Funtional Testing now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.