Python Regular Expressions for Custom Entities

When you create the regular expression for your custom entity, use the Python regular expression syntax. The following contains information about using Python regular expressions for custom entities.

Note

Regular expressions for custom entities are case insensitive.

Escape Backslash Characters

If your Python regular expression contains a backslash character, then you must replace each backslash character with two backslashes. For example, given a custom entity books\books, you would create the Python regular expression, books[\\]books.

Non-Capturing Groups

If you want to use parentheses () in your regular expression, use the non-capturing version (?:). Capturing contents of a group is not supported. Review the following example:

Correct - non-capturing version includes the question mark and colon (?:).

\s(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(?!\.)\b

Incorrect - original version does not include the question mark and colon (?:).

\s((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(?!\.)\b

Loading...