Top Method Summary
Options Name Purpose
CHARACTER ApplyReplacement (character, integer, integer) Applies a replacement string to produce the substitution text Notes : Recognizes $0 / \0 (full match), $1..$9 / \1..\9 (capture groups), $& (full match alias). All other characters are passed through literally. @param pcReplacement The replacement template string @param piMatchStart The 1-based start position of the match in cInput @param piMatchEnd The position after the last matched character @return The replacement text with back-references resolved */
Consultingwerk.Framework.RegEx.RegExMatch BuildMatch (integer, integer) Constructs a RegExMatch from the current match state Notes : @param piStart The 1-based start position of the match in cInput @param piEnd The position after the last matched character @return A RegExMatch representing the current match and captured groups */
ClearGroups () Resets all capture group start and end positions to zero Notes : */
CHARACTER Escape (character) Escapes all regex metacharacters in the input string so that it can be used as a literal pattern Notes : Metacharacters escaped: backslash . * + ? ^ $ braces [ ] | ( ) @param pcInput The raw string to escape @return The input with all metacharacters preceded by a backslash */
Consultingwerk.Framework.RegEx.RegExMatch ExecuteMatch () Executes a first-match search using the already-set-up pattern and input Notes : Called by Match(pcPattern, pcInput, poOptions) after setup @return A RegExMatch for the first match, or ? if no match found */
Consultingwerk.Framework.RegEx.RegExMatch ExecuteMatchAll () Executes a find-all search using the already-set-up pattern and input Notes : Called by MatchAll after setup @return An extent of RegExMatch objects for every non-overlapping match */
CHARACTER ExecuteReplace (character) Executes a first-match replace using the already-set-up pattern and input Notes : Called by Replace after setup @param pcReplacement The replacement template @return The input string with the first match replaced */
CHARACTER ExecuteReplaceAll (character) Executes a replace-all using the already-set-up pattern and input Notes : Called by ReplaceAll after setup @param pcReplacement The replacement template @return The input string with all matches replaced */
CHARACTER FindTopLevelAlts (integer, integer) Finds positions of top-level alternation operators (|) within the given pattern range Notes : Top-level means depth 0 - not inside any group or character class. Returns positions encoded as CHR(1)-separated integers. @param piStart The first pattern position to scan (inclusive) @param piEnd The last pattern position to scan (inclusive) @return CHR(1)-separated list of | positions, or "" if none found */
INTEGER GetAtomEnd (integer) Returns the pattern position of the last character of the atom starting at piPatPos Notes : An atom is a single matchable unit: a literal character, an escape sequence (\d), a character class ([...]), or a group ((...)). Quantifiers (* + ?) are NOT part of the atom. @param piPatPos The 1-based start position in the pattern @return The 1-based end position (inclusive) of the atom */
INTEGER GetGroupInnerStart (integer) Returns the first content position inside a group atom Notes : Accounts for (?:, (?=, (?!, (?<=, (?<!, and (?<name> prefixes @param piPatPos The pattern position of the opening '(' @return The pattern position of the first interior character */
LOGICAL IsWordChar (integer) Returns TRUE when the character with the given ASCII code is a word character (\w class: A-Z, a-z, 0-9, _) Notes : Used by word-boundary assertions (\b and \B) @param piAsc ASCII code of the character to test @return TRUE if the character is a word character */
Consultingwerk.Framework.RegEx.RegExMatch Match (character, character) Returns the first match of the pattern anywhere in the input Notes : Converts the character input to longchar and delegates. Returns ? (unknown object reference) when no match is found. @param pcPattern The regular expression pattern @param pcInput The input string to search @return A RegExMatch for the first match, or ? if no match found */
Consultingwerk.Framework.RegEx.RegExMatch Match (character, character, RegExOptions) Returns the first match of the pattern anywhere in the input Notes : Converts the character input to longchar and delegates. Returns ? (unknown object reference) when no match is found. @param pcPattern The regular expression pattern @param pcInput The input string to search @param poOptions Matching options (case-insensitive, ignore whitespace) @return A RegExMatch for the first match, or ? if no match found */
Consultingwerk.Framework.RegEx.RegExMatch Match (character, longchar) Returns the first match of the pattern anywhere in the longchar input Notes : Returns ? (unknown object reference) when no match is found. @param pcPattern The regular expression pattern @param plcInput The longchar input to search @return A RegExMatch for the first match, or ? if no match found */
Consultingwerk.Framework.RegEx.RegExMatch Match (character, longchar, RegExOptions) Returns the first match of the pattern anywhere in the longchar input Notes : Returns ? (unknown object reference) when no match is found. @param pcPattern The regular expression pattern @param plcInput The longchar input to search @param poOptions Matching options (case-insensitive, ignore whitespace) @return A RegExMatch for the first match, or ? if no match found */
Consultingwerk.Framework.RegEx.RegExMatch MatchAll (character, character) Returns all non-overlapping matches of the pattern in the input Notes : Converts the character input to longchar and delegates. Returns an indeterminate extent when no matches are found. @param pcPattern The regular expression pattern @param pcInput The input string to search @return An extent of RegExMatch objects for every non-overlapping match */
Consultingwerk.Framework.RegEx.RegExMatch MatchAll (character, character, RegExOptions) Returns all non-overlapping matches of the pattern in the input Notes : Converts the character input to longchar and delegates. Returns an indeterminate extent when no matches are found. @param pcPattern The regular expression pattern @param pcInput The input string to search @param poOptions Matching options (case-insensitive, ignore whitespace) @return An extent of RegExMatch objects for every non-overlapping match */
Consultingwerk.Framework.RegEx.RegExMatch MatchAll (character, longchar) Returns all non-overlapping matches of the pattern in the longchar input Notes : Returns an indeterminate extent when no matches are found. @param pcPattern The regular expression pattern @param plcInput The longchar input to search @return An extent of RegExMatch objects for every non-overlapping match */
Consultingwerk.Framework.RegEx.RegExMatch MatchAll (character, longchar, RegExOptions) Returns all non-overlapping matches of the pattern in the longchar input Notes : Returns an indeterminate extent when no matches are found. @param pcPattern The regular expression pattern @param plcInput The longchar input to search @param poOptions Matching options (case-insensitive, ignore whitespace) @return An extent of RegExMatch objects for every non-overlapping match */
INTEGER MatchAtom (integer, integer, integer) Matches a single atom at input position piInpPos Notes : Handles literals, escape sequences, character classes, groups, dot (any char), anchors (^ $), and word boundaries (\b \B). Returns the new input position after the match, or -1 on failure. Zero-width assertions return piInpPos on success. @param piAtomStart First pattern position of the atom @param piAtomEnd Last pattern position of the atom @param piInpPos Current 1-based input position @return New input position on success, -1 on failure */
LOGICAL MatchCharClass (integer, integer, character) Tests whether pcChar matches the character class defined by the pattern range [piClassStart..piClassEnd] Notes : piClassStart points to '[' and piClassEnd points to ']'. Handles negation (^), ranges (a-z), and escape sequences. @param piClassStart Pattern position of '[' @param piClassEnd Pattern position of ']' @param pcChar The single input character to test @return TRUE if pcChar is in (or out of, for negated classes) the class */
LOGICAL MatchEscapeClass (character, character) Tests whether pcChar matches the escape class denoted by cEsc Notes : \d = digit, \D = non-digit, \w = word char, \W = non-word, \s = whitespace, \S = non-whitespace. Any other escape char is treated as a literal match. @param pcEsc The character following the backslash in the pattern @param pcChar The single input character to test @return TRUE if pcChar satisfies the escape class */
INTEGER MatchFrom (integer, integer, integer) Main recursive entry: matches pattern[piPatStart..piPatEnd] against input starting at piInpPos, handling top-level alternation Notes : Returns the new input position after the match on success, or -1 on failure. Capture group arrays are updated on success. @param piPatStart First pattern position (inclusive) @param piPatEnd Last pattern position (inclusive) @param piInpPos Current 1-based input position @return New input position on success, -1 on failure */
INTEGER MatchGreedy (integer, integer, integer, integer, integer, integer, integer, logical) Matches an atom with a quantifier and the remaining pattern, using greedy or lazy matching with backtracking Notes : Greedily collects up to piMaxCount repetitions, then iterates from the longest (greedy) or shortest (lazy) match inward until a successful overall match is found or all options are exhausted. @param piAtomStart First pattern position of the atom (inclusive) @param piAtomEnd Last pattern position of the atom (inclusive) @param piRestStart First pattern position after the quantifier @param piRestEnd Last pattern position (inclusive) @param piMinCount Minimum required repetitions @param piMaxCount Maximum allowed repetitions @param piInpPos Current 1-based input position @param plLazy TRUE for lazy (shortest-first) matching @return New input position on success, -1 on failure */
INTEGER MatchSequence (integer, integer, integer) Matches a sequence of terms (no top-level alternation) within pattern[piPatStart..piPatEnd] against input from piInpPos Notes : Processes atoms left to right; handles quantifiers by delegating to MatchGreedy so backtracking works correctly. @param piPatStart First pattern position (inclusive) @param piPatEnd Last pattern position (inclusive) @param piInpPos Current 1-based input position @return New input position on success, -1 on failure */
CHARACTER Replace (character, character, character) Replaces the first occurrence of the pattern with a replacement string Notes : Converts the character input to longchar and delegates. The replacement string may contain back-references: $1 or \1 for capture group 1, $0 for the entire match. @param pcPattern The regular expression pattern @param pcInput The input string @param pcReplacement The replacement string (may contain back-references) @return The input string with the first match replaced */
CHARACTER Replace (character, character, character, RegExOptions) Replaces the first occurrence of the pattern with a replacement string Notes : Converts the character input to longchar and delegates. The replacement string may contain back-references: $1 or \1 for capture group 1, $0 for the entire match. @param pcPattern The regular expression pattern @param pcInput The input string @param pcReplacement The replacement string (may contain back-references) @param poOptions Matching options (case-insensitive, ignore whitespace) @return The input string with the first match replaced */
LONGCHAR Replace (character, longchar, character) Replaces the first occurrence of the pattern with a replacement string Notes : The replacement string may contain back-references: $1 or \1 for capture group 1, $0 for the entire match. @param pcPattern The regular expression pattern @param plcInput The longchar input @param pcReplacement The replacement string (may contain back-references) @return The longchar input with the first match replaced */
LONGCHAR Replace (character, longchar, character, RegExOptions) Replaces the first occurrence of the pattern with a replacement string Notes : The replacement string may contain back-references: $1 or \1 for capture group 1, $0 for the entire match. @param pcPattern The regular expression pattern @param plcInput The longchar input @param pcReplacement The replacement string (may contain back-references) @param poOptions Matching options (case-insensitive, ignore whitespace) @return The longchar input with the first match replaced */
CHARACTER ReplaceAll (character, character, character) Replaces all non-overlapping occurrences of the pattern Notes : Converts the character input to longchar and delegates. The replacement string may contain back-references: $1 or \1 for capture group 1, $0 for the entire match. @param pcPattern The regular expression pattern @param pcInput The input string @param pcReplacement The replacement string (may contain back-references) @return The input string with all matches replaced */
CHARACTER ReplaceAll (character, character, character, RegExOptions) Replaces all non-overlapping occurrences of the pattern Notes : Converts the character input to longchar and delegates. The replacement string may contain back-references: $1 or \1 for capture group 1, $0 for the entire match. @param pcPattern The regular expression pattern @param pcInput The input string @param pcReplacement The replacement string (may contain back-references) @param poOptions Matching options (case-insensitive, ignore whitespace) @return The input string with all matches replaced */
LONGCHAR ReplaceAll (character, longchar, character) Replaces all non-overlapping occurrences of the pattern Notes : The replacement string may contain back-references: $1 or \1 for capture group 1, $0 for the entire match. @param pcPattern The regular expression pattern @param plcInput The longchar input @param pcReplacement The replacement string (may contain back-references) @return The longchar input with all matches replaced */
LONGCHAR ReplaceAll (character, longchar, character, RegExOptions) Replaces all non-overlapping occurrences of the pattern Notes : The replacement string may contain back-references: $1 or \1 for capture group 1, $0 for the entire match. @param pcPattern The regular expression pattern @param plcInput The longchar input @param pcReplacement The replacement string (may contain back-references) @param poOptions Matching options (case-insensitive, ignore whitespace) @return The longchar input with all matches replaced */
RestoreGroupState (character) Restores capture group state from a serialized string Notes : Used for save/restore during backtracking @param pcState The encoded group state string from SaveGroupState */
CHARACTER SaveGroupState () Serializes the current capture group state to a character string Notes : Used for save/restore during backtracking @return Encoded group state string */
SetOptions (RegExOptions) Applies the given RegExOptions to the current instance state Notes : Must be called before SetupPattern so preprocessing is active @param poOptions The options enum value to apply */
SetupInput (longchar) Prepares the input string for matching Notes : Converts the longchar input to character internally @param plcInput The longchar input to set up */
SetupPattern (character) Validates and prepares the pattern for matching Notes : Pre-computes capture group numbers and validates syntax @param pcPattern The regular expression pattern to set up */
LOGICAL Test (character, character) Tests whether the pattern matches anywhere in the input string Notes : Converts the character input to longchar and delegates. @param pcPattern The regular expression pattern @param pcInput The input string to test @return TRUE if the pattern matches anywhere in the input */
LOGICAL Test (character, character, RegExOptions) Tests whether the pattern matches anywhere in the input string Notes : Converts the character input to longchar and delegates. @param pcPattern The regular expression pattern @param pcInput The input string to test @param poOptions Matching options (case-insensitive, ignore whitespace) @return TRUE if the pattern matches anywhere in the input */
LOGICAL Test (character, longchar) Tests whether the pattern matches anywhere in the longchar input Notes : The pattern is tested at every starting position in the input. @param pcPattern The regular expression pattern @param plcInput The longchar input to test @return TRUE if the pattern matches anywhere in the input */
LOGICAL Test (character, longchar, RegExOptions) Tests whether the pattern matches anywhere in the longchar input Notes : The pattern is tested at every starting position in the input. @param pcPattern The regular expression pattern @param plcInput The longchar input to test @param poOptions Matching options (case-insensitive, ignore whitespace) @return TRUE if the pattern matches anywhere in the input */
ValidatePattern (character) Validates the basic syntax of a regular expression pattern Notes : Checks for balanced parentheses and brackets, incomplete escape sequences, and misplaced quantifiers. @param pcPattern The pattern string to validate */


Method Detail
Top

CHARACTER ApplyReplacement (character, integer, integer)

Purpose: Applies a replacement string to produce the substitution text
Notes : Recognizes $0 / \0 (full match), $1..$9 / \1..\9 (capture groups),
$& (full match alias). All other characters are passed through literally.

Parameters:
pcReplacement CHARACTER
The replacement template string
piMatchStart INTEGER
The 1-based start position of the match in cInput
piMatchEnd INTEGER
The position after the last matched character
Returns CHARACTER
The replacement text with back-references resolved
Top

Consultingwerk.Framework.RegEx.RegExMatch BuildMatch (integer, integer)

Purpose: Constructs a RegExMatch from the current match state
Notes :

Parameters:
piStart INTEGER
The 1-based start position of the match in cInput
piEnd INTEGER
The position after the last matched character
Returns Consultingwerk.Framework.RegEx.RegExMatch
A RegExMatch representing the current match and captured groups
Top

ClearGroups ()

Purpose: Resets all capture group start and end positions to zero
Notes :

Top

CHARACTER Escape (character)

Purpose: Escapes all regex metacharacters in the input string so that it
can be used as a literal pattern
Notes : Metacharacters escaped: backslash . * + ? ^ $ braces [ ] | ( )

Parameters:
pcInput CHARACTER
The raw string to escape
Returns CHARACTER
The input with all metacharacters preceded by a backslash
Top

Consultingwerk.Framework.RegEx.RegExMatch ExecuteMatch ()

Purpose: Executes a first-match search using the already-set-up pattern and input
Notes : Called by Match(pcPattern, pcInput, poOptions) after setup

Returns Consultingwerk.Framework.RegEx.RegExMatch
A RegExMatch for the first match, or ? if no match found
Top

Consultingwerk.Framework.RegEx.RegExMatch ExecuteMatchAll ()

Purpose: Executes a find-all search using the already-set-up pattern and input
Notes : Called by MatchAll after setup

Returns Consultingwerk.Framework.RegEx.RegExMatch
An extent of RegExMatch objects for every non-overlapping match
Top

CHARACTER ExecuteReplace (character)

Purpose: Executes a first-match replace using the already-set-up pattern and input
Notes : Called by Replace after setup

Parameters:
pcReplacement CHARACTER
The replacement template
Returns CHARACTER
The input string with the first match replaced
Top

CHARACTER ExecuteReplaceAll (character)

Purpose: Executes a replace-all using the already-set-up pattern and input
Notes : Called by ReplaceAll after setup

Parameters:
pcReplacement CHARACTER
The replacement template
Returns CHARACTER
The input string with all matches replaced
Top

CHARACTER FindTopLevelAlts (integer, integer)

Purpose: Finds positions of top-level alternation operators (|) within
the given pattern range
Notes : Top-level means depth 0 - not inside any group or character class.
Returns positions encoded as CHR(1)-separated integers.

Parameters:
piStart INTEGER
The first pattern position to scan (inclusive)
piEnd INTEGER
The last pattern position to scan (inclusive)
Returns CHARACTER
CHR(1)-separated list of | positions, or "" if none found
Top

INTEGER GetAtomEnd (integer)

Purpose: Returns the pattern position of the last character of the atom
starting at piPatPos
Notes : An atom is a single matchable unit: a literal character, an
escape sequence (\d), a character class ([...]), or a group ((...)).
Quantifiers (* + ?) are NOT part of the atom.

Parameters:
piPatPos INTEGER
The 1-based start position in the pattern
Returns INTEGER
The 1-based end position (inclusive) of the atom
Top

INTEGER GetGroupInnerStart (integer)

Purpose: Returns the first content position inside a group atom
Notes : Accounts for (?:, (?=, (?!, (?<=, (?<!, and (?<name> prefixes

Parameters:
piPatPos INTEGER
The pattern position of the opening '('
Returns INTEGER
The pattern position of the first interior character
Top

LOGICAL IsWordChar (integer)

Purpose: Returns TRUE when the character with the given ASCII code is a
word character (\w class: A-Z, a-z, 0-9, _)
Notes : Used by word-boundary assertions (\b and \B)

Parameters:
piAsc INTEGER
ASCII code of the character to test
Returns LOGICAL
TRUE if the character is a word character
Top

Consultingwerk.Framework.RegEx.RegExMatch Match (character, character)

Purpose: Returns the first match of the pattern anywhere in the input
Notes : Converts the character input to longchar and delegates.
Returns ? (unknown object reference) when no match is found.

Parameters:
pcPattern CHARACTER
The regular expression pattern
pcInput CHARACTER
The input string to search
Returns Consultingwerk.Framework.RegEx.RegExMatch
A RegExMatch for the first match, or ? if no match found
Top

Consultingwerk.Framework.RegEx.RegExMatch Match (character, character, RegExOptions)

Purpose: Returns the first match of the pattern anywhere in the input
Notes : Converts the character input to longchar and delegates.
Returns ? (unknown object reference) when no match is found.

Parameters:
pcPattern CHARACTER
The regular expression pattern
pcInput CHARACTER
The input string to search
poOptions Consultingwerk.Framework.RegEx.RegExOptions
Matching options (case-insensitive, ignore whitespace)
Returns Consultingwerk.Framework.RegEx.RegExMatch
A RegExMatch for the first match, or ? if no match found
Top

Consultingwerk.Framework.RegEx.RegExMatch Match (character, longchar)

Purpose: Returns the first match of the pattern anywhere in the longchar input
Notes : Returns ? (unknown object reference) when no match is found.

Parameters:
pcPattern CHARACTER
The regular expression pattern
plcInput LONGCHAR
The longchar input to search
Returns Consultingwerk.Framework.RegEx.RegExMatch
A RegExMatch for the first match, or ? if no match found
Top

Consultingwerk.Framework.RegEx.RegExMatch Match (character, longchar, RegExOptions)

Purpose: Returns the first match of the pattern anywhere in the longchar input
Notes : Returns ? (unknown object reference) when no match is found.

Parameters:
pcPattern CHARACTER
The regular expression pattern
plcInput LONGCHAR
The longchar input to search
poOptions Consultingwerk.Framework.RegEx.RegExOptions
Matching options (case-insensitive, ignore whitespace)
Returns Consultingwerk.Framework.RegEx.RegExMatch
A RegExMatch for the first match, or ? if no match found
Top

Consultingwerk.Framework.RegEx.RegExMatch MatchAll (character, character)

Purpose: Returns all non-overlapping matches of the pattern in the input
Notes : Converts the character input to longchar and delegates.
Returns an indeterminate extent when no matches are found.

Parameters:
pcPattern CHARACTER
The regular expression pattern
pcInput CHARACTER
The input string to search
Returns Consultingwerk.Framework.RegEx.RegExMatch
An extent of RegExMatch objects for every non-overlapping match
Top

Consultingwerk.Framework.RegEx.RegExMatch MatchAll (character, character, RegExOptions)

Purpose: Returns all non-overlapping matches of the pattern in the input
Notes : Converts the character input to longchar and delegates.
Returns an indeterminate extent when no matches are found.

Parameters:
pcPattern CHARACTER
The regular expression pattern
pcInput CHARACTER
The input string to search
poOptions Consultingwerk.Framework.RegEx.RegExOptions
Matching options (case-insensitive, ignore whitespace)
Returns Consultingwerk.Framework.RegEx.RegExMatch
An extent of RegExMatch objects for every non-overlapping match
Top

Consultingwerk.Framework.RegEx.RegExMatch MatchAll (character, longchar)

Purpose: Returns all non-overlapping matches of the pattern in the longchar input
Notes : Returns an indeterminate extent when no matches are found.

Parameters:
pcPattern CHARACTER
The regular expression pattern
plcInput LONGCHAR
The longchar input to search
Returns Consultingwerk.Framework.RegEx.RegExMatch
An extent of RegExMatch objects for every non-overlapping match
Top

Consultingwerk.Framework.RegEx.RegExMatch MatchAll (character, longchar, RegExOptions)

Purpose: Returns all non-overlapping matches of the pattern in the longchar input
Notes : Returns an indeterminate extent when no matches are found.

Parameters:
pcPattern CHARACTER
The regular expression pattern
plcInput LONGCHAR
The longchar input to search
poOptions Consultingwerk.Framework.RegEx.RegExOptions
Matching options (case-insensitive, ignore whitespace)
Returns Consultingwerk.Framework.RegEx.RegExMatch
An extent of RegExMatch objects for every non-overlapping match
Top

INTEGER MatchAtom (integer, integer, integer)

Purpose: Matches a single atom at input position piInpPos
Notes : Handles literals, escape sequences, character classes, groups,
dot (any char), anchors (^ $), and word boundaries (\b \B).
Returns the new input position after the match, or -1 on
failure. Zero-width assertions return piInpPos on success.

Parameters:
piAtomStart INTEGER
First pattern position of the atom
piAtomEnd INTEGER
Last pattern position of the atom
piInpPos INTEGER
Current 1-based input position
Returns INTEGER
New input position on success, -1 on failure
Top

LOGICAL MatchCharClass (integer, integer, character)

Purpose: Tests whether pcChar matches the character class defined by
the pattern range [piClassStart..piClassEnd]
Notes : piClassStart points to '[' and piClassEnd points to ']'.
Handles negation (^), ranges (a-z), and escape sequences.

Parameters:
piClassStart INTEGER
Pattern position of '['
piClassEnd INTEGER
Pattern position of ']'
pcChar CHARACTER
The single input character to test
Returns LOGICAL
TRUE if pcChar is in (or out of, for negated classes) the class
Top

LOGICAL MatchEscapeClass (character, character)

Purpose: Tests whether pcChar matches the escape class denoted by cEsc
Notes : \d = digit, \D = non-digit, \w = word char, \W = non-word,
\s = whitespace, \S = non-whitespace.
Any other escape char is treated as a literal match.

Parameters:
pcEsc CHARACTER
The character following the backslash in the pattern
pcChar CHARACTER
The single input character to test
Returns LOGICAL
TRUE if pcChar satisfies the escape class
Top

INTEGER MatchFrom (integer, integer, integer)

Purpose: Main recursive entry: matches pattern[piPatStart..piPatEnd] against
input starting at piInpPos, handling top-level alternation
Notes : Returns the new input position after the match on success,
or -1 on failure. Capture group arrays are updated on success.

Parameters:
piPatStart INTEGER
First pattern position (inclusive)
piPatEnd INTEGER
Last pattern position (inclusive)
piInpPos INTEGER
Current 1-based input position
Returns INTEGER
New input position on success, -1 on failure
Top

INTEGER MatchGreedy (integer, integer, integer, integer, integer, integer, integer, logical)

Purpose: Matches an atom with a quantifier and the remaining pattern, using
greedy or lazy matching with backtracking
Notes : Greedily collects up to piMaxCount repetitions, then iterates
from the longest (greedy) or shortest (lazy) match inward until
a successful overall match is found or all options are exhausted.

Parameters:
piAtomStart INTEGER
First pattern position of the atom (inclusive)
piAtomEnd INTEGER
Last pattern position of the atom (inclusive)
piRestStart INTEGER
First pattern position after the quantifier
piRestEnd INTEGER
Last pattern position (inclusive)
piMinCount INTEGER
Minimum required repetitions
piMaxCount INTEGER
Maximum allowed repetitions
piInpPos INTEGER
Current 1-based input position
plLazy LOGICAL
TRUE for lazy (shortest-first) matching
Returns INTEGER
New input position on success, -1 on failure
Top

INTEGER MatchSequence (integer, integer, integer)

Purpose: Matches a sequence of terms (no top-level alternation) within
pattern[piPatStart..piPatEnd] against input from piInpPos
Notes : Processes atoms left to right; handles quantifiers by delegating
to MatchGreedy so backtracking works correctly.

Parameters:
piPatStart INTEGER
First pattern position (inclusive)
piPatEnd INTEGER
Last pattern position (inclusive)
piInpPos INTEGER
Current 1-based input position
Returns INTEGER
New input position on success, -1 on failure
Top

CHARACTER Replace (character, character, character)

Purpose: Replaces the first occurrence of the pattern with a replacement string
Notes : Converts the character input to longchar and delegates.
The replacement string may contain back-references: $1 or \1 for
capture group 1, $0 for the entire match.

Parameters:
pcPattern CHARACTER
The regular expression pattern
pcInput CHARACTER
The input string
pcReplacement CHARACTER
The replacement string (may contain back-references)
Returns CHARACTER
The input string with the first match replaced
Top

CHARACTER Replace (character, character, character, RegExOptions)

Purpose: Replaces the first occurrence of the pattern with a replacement string
Notes : Converts the character input to longchar and delegates.
The replacement string may contain back-references: $1 or \1 for
capture group 1, $0 for the entire match.

Parameters:
pcPattern CHARACTER
The regular expression pattern
pcInput CHARACTER
The input string
pcReplacement CHARACTER
The replacement string (may contain back-references)
poOptions Consultingwerk.Framework.RegEx.RegExOptions
Matching options (case-insensitive, ignore whitespace)
Returns CHARACTER
The input string with the first match replaced
Top

LONGCHAR Replace (character, longchar, character)

Purpose: Replaces the first occurrence of the pattern with a replacement string
Notes : The replacement string may contain back-references: $1 or \1 for
capture group 1, $0 for the entire match.

Parameters:
pcPattern CHARACTER
The regular expression pattern
plcInput LONGCHAR
The longchar input
pcReplacement CHARACTER
The replacement string (may contain back-references)
Returns LONGCHAR
The longchar input with the first match replaced
Top

LONGCHAR Replace (character, longchar, character, RegExOptions)

Purpose: Replaces the first occurrence of the pattern with a replacement string
Notes : The replacement string may contain back-references: $1 or \1 for
capture group 1, $0 for the entire match.

Parameters:
pcPattern CHARACTER
The regular expression pattern
plcInput LONGCHAR
The longchar input
pcReplacement CHARACTER
The replacement string (may contain back-references)
poOptions Consultingwerk.Framework.RegEx.RegExOptions
Matching options (case-insensitive, ignore whitespace)
Returns LONGCHAR
The longchar input with the first match replaced
Top

CHARACTER ReplaceAll (character, character, character)

Purpose: Replaces all non-overlapping occurrences of the pattern
Notes : Converts the character input to longchar and delegates.
The replacement string may contain back-references: $1 or \1 for
capture group 1, $0 for the entire match.

Parameters:
pcPattern CHARACTER
The regular expression pattern
pcInput CHARACTER
The input string
pcReplacement CHARACTER
The replacement string (may contain back-references)
Returns CHARACTER
The input string with all matches replaced
Top

CHARACTER ReplaceAll (character, character, character, RegExOptions)

Purpose: Replaces all non-overlapping occurrences of the pattern
Notes : Converts the character input to longchar and delegates.
The replacement string may contain back-references: $1 or \1 for
capture group 1, $0 for the entire match.

Parameters:
pcPattern CHARACTER
The regular expression pattern
pcInput CHARACTER
The input string
pcReplacement CHARACTER
The replacement string (may contain back-references)
poOptions Consultingwerk.Framework.RegEx.RegExOptions
Matching options (case-insensitive, ignore whitespace)
Returns CHARACTER
The input string with all matches replaced
Top

LONGCHAR ReplaceAll (character, longchar, character)

Purpose: Replaces all non-overlapping occurrences of the pattern
Notes : The replacement string may contain back-references: $1 or \1 for
capture group 1, $0 for the entire match.

Parameters:
pcPattern CHARACTER
The regular expression pattern
plcInput LONGCHAR
The longchar input
pcReplacement CHARACTER
The replacement string (may contain back-references)
Returns LONGCHAR
The longchar input with all matches replaced
Top

LONGCHAR ReplaceAll (character, longchar, character, RegExOptions)

Purpose: Replaces all non-overlapping occurrences of the pattern
Notes : The replacement string may contain back-references: $1 or \1 for
capture group 1, $0 for the entire match.

Parameters:
pcPattern CHARACTER
The regular expression pattern
plcInput LONGCHAR
The longchar input
pcReplacement CHARACTER
The replacement string (may contain back-references)
poOptions Consultingwerk.Framework.RegEx.RegExOptions
Matching options (case-insensitive, ignore whitespace)
Returns LONGCHAR
The longchar input with all matches replaced
Top

RestoreGroupState (character)

Purpose: Restores capture group state from a serialized string
Notes : Used for save/restore during backtracking

Parameters:
pcState CHARACTER
The encoded group state string from SaveGroupState
Top

CHARACTER SaveGroupState ()

Purpose: Serializes the current capture group state to a character string
Notes : Used for save/restore during backtracking

Returns CHARACTER
Encoded group state string
Top

SetOptions (RegExOptions)

Purpose: Applies the given RegExOptions to the current instance state
Notes : Must be called before SetupPattern so preprocessing is active

Parameters:
poOptions Consultingwerk.Framework.RegEx.RegExOptions
The options enum value to apply
Top

SetupInput (longchar)

Purpose: Prepares the input string for matching
Notes : Converts the longchar input to character internally

Parameters:
plcInput LONGCHAR
The longchar input to set up
Top

SetupPattern (character)

Purpose: Validates and prepares the pattern for matching
Notes : Pre-computes capture group numbers and validates syntax

Parameters:
pcPattern CHARACTER
The regular expression pattern to set up
Top

LOGICAL Test (character, character)

Purpose: Tests whether the pattern matches anywhere in the input string
Notes : Converts the character input to longchar and delegates.

Parameters:
pcPattern CHARACTER
The regular expression pattern
pcInput CHARACTER
The input string to test
Returns LOGICAL
TRUE if the pattern matches anywhere in the input
Top

LOGICAL Test (character, character, RegExOptions)

Purpose: Tests whether the pattern matches anywhere in the input string
Notes : Converts the character input to longchar and delegates.

Parameters:
pcPattern CHARACTER
The regular expression pattern
pcInput CHARACTER
The input string to test
poOptions Consultingwerk.Framework.RegEx.RegExOptions
Matching options (case-insensitive, ignore whitespace)
Returns LOGICAL
TRUE if the pattern matches anywhere in the input
Top

LOGICAL Test (character, longchar)

Purpose: Tests whether the pattern matches anywhere in the longchar input
Notes : The pattern is tested at every starting position in the input.

Parameters:
pcPattern CHARACTER
The regular expression pattern
plcInput LONGCHAR
The longchar input to test
Returns LOGICAL
TRUE if the pattern matches anywhere in the input
Top

LOGICAL Test (character, longchar, RegExOptions)

Purpose: Tests whether the pattern matches anywhere in the longchar input
Notes : The pattern is tested at every starting position in the input.

Parameters:
pcPattern CHARACTER
The regular expression pattern
plcInput LONGCHAR
The longchar input to test
poOptions Consultingwerk.Framework.RegEx.RegExOptions
Matching options (case-insensitive, ignore whitespace)
Returns LOGICAL
TRUE if the pattern matches anywhere in the input
Top

ValidatePattern (character)

Purpose: Validates the basic syntax of a regular expression pattern
Notes : Checks for balanced parentheses and brackets, incomplete
escape sequences, and misplaced quantifiers.

Parameters:
pcPattern CHARACTER
The pattern string to validate


©2006-2026 Consultingwerk Ltd.         info@consultingwerk.de         http://www.consultingwerk.de       13.04.2026 10:21:39