This section describes the regular expressions syntax that Eduction supports.
The engine’s parser interprets regular expression syntax nearly identically to the UNIX regular expression syntax. The engine’s regular expression syntax also includes some extensions for matching substrings.
The following table the base regular expression operators available in the Eduction engine and the pattern the operator matches.
Operator |
Matched Pattern |
---|---|
\
|
Quote the next metacharacter. |
^
|
Match the beginning of a line. |
$
|
Match the end of a line. |
.
|
Match any character (except newline). |
|
|
Alternation. |
()
|
Used for grouping to force operator precedence. |
[xy]
|
The character |
[x-z]
|
The range of characters between |
[^z]
|
Any character except Note: For performance reasons, HPE recommends that you explicitly list all the characters that you want to match, rather than using this operator. |
Operator |
Matched Pattern |
---|---|
*
|
Match 0 or more times. |
+
|
Match 1 or more times. |
?
|
Match 0 or 1 times. |
{n}
|
Match exactly n times. |
{n,}
|
Match at least n times. |
{n,m}
|
Match at least n times, but no more than m times. |
Operator |
Matched Pattern |
---|---|
\t
|
Match tab. |
\n
|
Match newline. |
\r
|
Match return. |
\f
|
Match formfeed. |
\a
|
Match alarm (bell, beep, and so on). |
\e
|
Match escape. |
\v
|
Match vertical tab. |
\021
|
Match octal character (in this example, 21 octal). |
\xF0
|
Match hex character (in this example, F0 hex). |
\x{263a}
|
Match wide hex character (Unicode). |
\w
|
Match word character: [A-Za-z0-9_]. |
\W
|
Match non-word character: [^A-Za-z0-9_]. |
|
Match whitespace character. This metacharacter also includes \n and \r : [ \t\n\r]. |
\S
|
Match non-whitespace character: [^ \t\n\r]. |
\d
|
Match digit character: [0-9]. |
\D
|
Match non-digit character: [^0-9]. |
\b
|
Match word boundary. |
\B
|
Match non-word boundary. |
\A
|
Match start of string (never match at line breaks). |
\Z
|
Match end of string. Never match at line breaks; only match at the end of the final buffer of text submitted for matching. |
Operator |
Matched Pattern |
---|---|
(?A:entity)
|
Match a previously defined entity, which is then copied into the new entity’s definition. For example: <include path="number_types_eng.ecr"/> <entity name="fracpos" type="private"> <pattern>(?A:number/fracalpha/eng)</pattern> </entity> Copying an entity improves pattern execution speed, but increases compilation time and memory usage. It is recommended unless the copied entry is large and is copied multiple times. |
(?A^ entity )
|
Match a previously defined entity, which is then referenced by the new entity. Referencing an entity minimizes the size and memory usage of the grammar, but decreases performance. The performance impact can vary from unnoticeable to significant, depending on the size and structure of the grammar. |
(?A! expr )
|
Match the expression For example:
If this grammar is used to search the text
the text |
(?A= component : expr )
|
Define a component within an entity’s definition. A component is a named part of an entity. For example, the following grammar defines
If the data is as follows
and the following configuration options are set
then the output displays the |
Caution: Token properties will be deprecated in a future release. Users should use the equivalent explicit regular expresions instead of token properties.
Operator |
Match Pattern |
---|---|
|
Matches a token that satisfies the list of properties provided. The properties are specified in a comma-separated list of one or more of the following:
Any of these properties can be prefixed with the negation operator '!' for exclusion. |
|