RegEx

@RegEx ("expression"[,IgnoreCase|NoIgnoreCase]) 

This command is optional.

Matches a token to a regular expression and sets the casing option. Use the global casing option (%IgnoreCase) for the parsing grammar. For casing information, see IgnoreCase.

Example

<GivenName> = @RegEx("[A-Z]+",IgnoreCase)

For this rule to be true, a token must contain characters from A-Z one or more times and the casing of those characters will be ignored.

Regular expressions describe a set of strings based on common patterns shared by each string in the set. In Open Parser, they are used to search input data and output that data into the form you specify as OutputFields. Regular expressions vary in complexity. After you understand the basics of how regular expressions are constructed, you'll be able to create any regular expression. The syntax of the regular expressions supported is that defined in the Java documentation with the following differences:

  • Capturing groups and back references as defined by Java are not supported.
  • Posix-style character set classes are supported when defined using Domain Editor RegEx tags.
  • RegularExpression may not match an empty string. For example, @RegEx("[A-Z]?") or @RegEx("[A-Z]?") are not allowed because an empty string would be invalid.

The use of ? or * is not restricted, however, these quantifiers may be used as long as the expression does not match an empty string. For example, @RegEx("[A-Z]+\.?") is valid as only part of the expression is optional.

You can control how often the @RegEx command itself appears using * or ?. This restriction is just for the regular expression inside of the @RegEx command.

To use this command:

  1. Position the cursor where you want the command inserted.
  2. Double-click @RegEx in the Commands list.
  3. Select the expression name from the list or type a regular expression.
  4. Select a casing option.
    • Use global option means that the RegEx tag will use the case-sensitivity setting defined in the grammar rule. If %IgnoreCase is defined in the grammar rule, RegEx commands will be case sensitive. If it is not defined in the grammar rule, RegEx commands will not be case sensitive.
    • Case insensitive means that the RegEx tag will ignore case distinction when matching alphabetic characters.
    • Case sensitive means that the RegEx tag will evaluate case distinction when matching alphabetic characters.
  5. Click OK.