C++ Native Functions: com.teracloud.streams.regex.re2
- <enum E> public boolean regexCompile(rstring pattern, E patternIndex)
-
Compile and index a regular expression pattern
- Parameters
-
- pattern
-
regular expression pattern of type rstring.
- patternIndex
-
regular expression index of enum type (e.g. enum{_1}).
- Returns
-
true if regular expression compilation was successful; false otherwise.
- <enum E> public boolean regexCompile(rstring pattern, E patternIndex, int64 maxmem)
-
Compile and index regular expression pattern, allows to control max memory allocated.
- Parameters
-
- pattern
-
regular expression pattern of type rstring.
- patternIndex
-
regular expression index of enum type (e.g. enum{_1}).
- maxmem
-
maximum allocated memory allowed of type int64.
- Returns
-
true if regular expression compilation was successful; false otherwise.
- <enum E> public boolean regexExtract(rstring str, E patternIndex, mutable rstring rewrite)
-
Perform submatch extraction of parameters from the string after matching the pattern - runs in compiled mode (uses compiled regex index to identify the pattern). Use '\1' for first submatch in the rewrite string and so on.
Example
regexCompile("^([a-zA-Z]*), ([a-zA-Z]*)", RegexPattern._1); mutable rstring newString = '\1, Good \2'; regexExtract("Hello, World!", RegexPattern._1, newString); // newString will now contain 'Hello, Good World'- Parameters
-
- str
-
string to match of type rstring.
- patternIndex
-
regular expression index of enum type (e.g. enum{_1}).
- rewrite
-
string to construct with the extracted parameters of type rstring.
- Returns
-
true if match was found; false otherwise.
- <enum E> public boolean regexFullMatch(rstring str, E patternIndex)
-
Perform a full (exact) match of the input string with the pattern - runs in compiled mode (uses compiled regex index to identify the pattern).
- Parameters
-
- str
-
string to match of type rstring.
- patternIndex
-
regular expression index of enum type (e.g. enum{_1}).
- Returns
-
true if match was found; false otherwise.
- public boolean regexFullMatch(rstring str, rstring pattern)
-
Perform a full (exact) match of the input string with the pattern - runs in interpretation mode.
- Parameters
-
- str
-
string to match of type rstring.
- pattern
-
regular expression of type rstring.
- Returns
-
true if match was found; false otherwise.
- <enum E> public int32 regexGlobalReplace(mutable rstring str, E patternIndex, rstring rewrite)
-
Perform all replacements of the string after matching the pattern - runs in compiled mode (uses compiled regex index to identify the pattern).
- Parameters
-
- str
-
string to match of type rstring.
- patternIndex
-
regular expression index of enum type (e.g. enum{_1}).
- rewrite
-
replace string of type rstring.
- Returns
-
number of matches found.
- <enum E> public boolean regexPartialMatch(rstring str, E patternIndex)
-
Perform a partial match of the string with the pattern - runs in compiled mode (uses compiled regex index to identify the pattern).
- Parameters
-
- str
-
string to match of type rstring.
- patternIndex
-
regular expression index of enum type (e.g. enum{_1}).
- Returns
-
true if match was found; false otherwise.
- public boolean regexPartialMatch(rstring str, rstring pattern)
-
Perform a partial match of the string with the provided pattern - runs in interpretation mode.
- Parameters
-
- str
-
string to match of type rstring.
- pattern
-
regular expression of type rstring.
- Returns
-
true if match was found; false otherwise.
- <enum E> public boolean regexReplace(mutable rstring str, E patternIndex, rstring rewrite)
-
Perform one replacement of the string after matching the pattern - runs in compiled mode (uses compiled regex index to identify the pattern).
- Parameters
-
- str
-
string to match of type rstring.
- patternIndex
-
regular expression index of enum type (e.g. enum{_1}).
- rewrite
-
replace string of type rstring.
- Returns
-
true if match was found; false otherwise.