Skip to main content
Skip table of contents

Regular Expressions for Fields

A regular expression, or RegEx, is a text string using special symbols that is used as a search pattern for a particular data element. For example, you may use a RegEx to define what a social security number or an AR invoice number should look like.

When managing fields, regular expressions can be leveraged for use Key Free Indexing. Beginning with GlobalSearch 6.3, the Regular Expression capabilities have been extended to include format enforcement and notification for Character fields as well.

When creating or editing fields, the regular expression options are available.

Key Free Indexing

Regular expressions are used to enable auto-highlighting during KeyFree Indexing. This feature further improves indexing speeds by bringing the user's attention to the most likely areas where data for a Field may be found.

When a RegEx is provided for a Field that is being populated through KeyFree Indexing, GlobalSearch will attempt to find any data in the document that matches the RegEx. Any matches that are found will be highlighted and the mouse cursor will jump to the first found pattern. You can use double pipes ( || ) to join alternate Regex patterns as well.

For example, the following RegEx is used to locate a zip code as 1) a five-digit string, 2) a five-digit string followed by a hyphen and a four-digit string, 3) a five-digit string followed by a four-digit string:

  • ^\d{5}(?:[-\s]\d{4})?$

  • \d{5} = Match 5 digits (for all three sample patterns)

  • [-\s] = Match a hyphen (for sample 2) or a space (for sample 3)

  • \d{4} = Match 4 digits (for samples 2, 3)

Character Field Patterns and User Messaging

GlobalSearch 6.3 and greater includes an option for “Use Regular Expression Validation”. When selected, this option will update the interface with a drop down selection of ready to use formats. Alternately, and Custom option is available for admins to create their own.

When choosing a custom format, two new options are enabled for the pattern and the user message.

In the Regular Expression field, enter a pattern to validate user entered data. As an example, Email would use a Regular Expression of:

[^@ \t\r\n]+@[^@ \t\r\n]+\.[^@ \t\r\n]+

Email would have a validation message like:

Enter an email address (

The document viewer will enforce the pattern at the time of data entry. When invalid data is detected that is not consistent with the pattern, the user will be alerted as below.

Remember, Regular Expressions are only enforced against Character field types.

If necessary, the list of Sample Expressions can be augmented. Refer to the KB article here.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.