|
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
*/
|