Matching Simple Strings
The simplest and most common type of regex is an alphanumeric string that matches itself, called a "literal text match". A literal text regex matches anywhere along a string. For example, a literal string matches itself when placed alone, and at the beginning, middle, or end of a larger string. Literal text matches are case sensitive.
Using regexes to search for simple strings.
Example 1: Search for the string "at".
- Regex:
at
- Matches:
at math hat ate
- Doesn't Match:
it a-t At
Example 2: Search for the string "email".
- Regex:
email
- Matches:
email emailing many_emails
- Doesn't Match:
Email EMAILing e-mails
Example 3: Search for the string "abcdE567".
- Regex:
abcdE567
- Matches:
abcdE567 AabcdE567ing text_abcdE567
- Doesn't Match:
SPAMabCdE567 ABCDe567
Note
Regular expressions are case sensitive unless case is deliberately
modified.© 2017 Sophos Limited. All rights reserved.