Regular expressions in explanations

A regular expression explanation type allows you to create patterns that help find and identify certain text strings in documents. A regular expression type is especially useful when you create an explanation that identifies and extracts information in similar formats, such as email addresses, bank account numbers, or URLs.

When you add a regular expression by using a template, it automatically adds the name and the regular expression to the text box. For example, if you choose the Email address template, the Create an explanation panel will be populated.

Important: Line anchors are not currently supported in regular expressions. You will not be able to specify a position in a string where a match must occur.

Important: Case sensitivity is not currently supported in regular expressions. Matches performed will not be case-sensitive.

Available templates:

Email id

The regular expression template for an email address is: [A-Za-z0-9._%-]+@[A-Za-z0-9.-]+.[A-Za-z]{2,6}.

This expression matches the most common pattern of email address. Matches a string of characters followed by an @ sign and then a two part domain name. 

URL

The regular expression for a URL is: \b(https?|ftp|file)://\S+

This expression matches a URL beginning with http, https, ftp, or file

US ITIN number

The regular expression for a US ITIN number is: \b9\d{2}[ \-]?[7|8]\d[ \-]?\d{4}\b 

This expression matches a 3 digit number starting with 9 followed by a 6 digit number starting with 7 or 8 

US Bank account number

The regular expression for this template is: \b\d{6,17} 

This expression matches any number from 6 to 17 digits long. US Bank Account Numbers fit this pattern. You can also use this template to match other numbers that are between 6 and 17 digits.

Learn more about regular expressions

Need more help?

Expand your Office skills
Explore training
Get new features first
Join Office Insiders

Was this information helpful?

×