Skip Navigation
Expand
Using the pipe ( | ) and spaces with regular expressions
Answer ID 835   |   Last Review Date 07/30/2019

When configuring a regular expression that uses the pipe feature ( | ) for an "or" statement, should I include a space between the text and the pipe?

Environment:

Business Rules using Regular Expressions
Oracle B2C Service

Resolution:

In general, you should not include a space between the text and the pipe. Including a space in this type of regular expression will limit when the regular expression is matched and in this case, the space becomes part of the regular expression to be matched.

For example, if you create a workflow rule that includes a regular expression for "cap | hat" in the Summary field, where there are spaces included on either side of the pipe, the rule will match only if there is a space after the cap sequence OR if there is a space before the hat sequence.

However, there are cases where you might want to include a space as part of the regular expression -- specifically when defining a specific word to be matched. For more information on matching a specific word, refer to Answer ID 861: Records Matching Incorrect Regular Expressions.

Additionally, it's also important to understand the 'Regular Expression' operator evaluates the raw data/text that is input into the database.

Available Languages for this Answer:

Notify Me
The page will refresh upon submission. Any pending input will be lost.