Lesson 2
Matching Single Characters
In this lesson you’ll learn how to perform simple character matches of one or more characters.
Matching Literal Text
Ben
is a regular expression. Because it is plain text, it may not look like a regular expression, but it is. Regular expressions can contain plain text (and may even contain only plain text). Admittedly, this is a total waste of regular expression processing, but it’s a good place to start.
So, here goes:
Text
Hello, my name is Ben. Please visit my website at http://www.forta.com/.
RegEx
Ben
Result
Hello, my name is Ben. Please visit my website at http://www.forta.com/.
Analysis
The regular expression used here is literal text and ...
Get Learning Regular Expressions, First Edition 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.