Platforms to show: All Mac Windows Linux Cross-Platform

Back to RegExMBS class.

RegExMBS.Compile(pattern as string) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Regular Expressions MBS RegEx Plugin 6.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Compiles a pattern.
Example
Var r as new RegExMBS
Var searchString as string = ".o"

if r.Compile(searchString) then
msgbox "OK"
else
MsgBox "failed to compile"
end if

Some predefined patterns like \b do not support Unicode well, so you may work around that by using your own pattern.

Returns true on success and false on failure.
ErrorMessage, Lasterror, ErrorOffset and Handle are set.

The following table lists the error codes than may be returned by Compile(), along with the error messages that may be returned by both compiling functions.

0no error
1\ at end of pattern
2\c at end of pattern
3unrecognized character follows \
4numbers out of order in {} quantifier
5number too big in {} quantifier
6missing terminating ] for character class
7invalid escape sequence in character class
8range out of order in character class
9nothing to repeat
10operand of unlimited repeat could match the empty string
11internal error: unexpected repeat
12unrecognized character after (?
13POSIX named classes are supported only within a class
14missing )
15reference to non-existent subpattern
16erroffset passed as NULL
17unknown option bit(s) set
18missing ) after comment
19parentheses nested too deeply
20regular expression too large
21failed to get memory
22unmatched parentheses
23internal error: code overflow
24unrecognized character after (?<
25lookbehind assertion is not fixed length
26malformed number after (?(
27conditional group contains more than two branches
28assertion expected after (?(
29(?R or (?digits must be followed by )
30unknown POSIX class name
31POSIX collating elements are not supported
32this version of PCRE is not compiled with PCRE_UTF8 support
33spare error
34character value in \x{...} sequence is too large
35invalid condition (?(0)
36\C not allowed in lookbehind assertion
37PCRE does not support \L, \l, \N, \U, or \u
38number after (?C is > 255
39closing ) for (?C expected
40recursive call could loop indefinitely
41unrecognized character after (?P
42syntax error after (?P
43two named groups have the same name
44invalid UTF-8 string
45support for \P, \p, and \X has not been compiled
46malformed \P or \p sequence
47unknown property name after \P or \p

RegExMBS.CompileMemory(pattern as memoryblock, ByteOffset as Integer) as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Regular Expressions MBS RegEx Plugin 6.3 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Compiles a pattern.

Same as Compile, but the text is stored in a memoryblock and must be a 0 terminated C string.
Be careful to use valid UTF8 input and provide offset in byte units and not in characters.

RegExMBS.ConfigBSR as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Regular Expressions MBS RegEx Plugin 11.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Returns an integer whose value indicates what character sequences the \R escape sequence matches by default.

A value of 0 means that \R matches any Unicode line ending sequence; a value of 1 means that \R matches only CR, LF, or CRLF. The default can be overridden when a pattern is compiled or matched.

RegExMBS.ConfigLinkSize as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Regular Expressions MBS RegEx Plugin 11.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Returns an integer that contains the number of bytes used for internal linkage in compiled regular expressions.

The value is 2, 3, or 4. Larger values allow larger regular expressions to be compiled, at the expense of slower matching. The default value of 2 is sufficient for all but the most massive patterns, since it allows the compiled pattern to be up to 64K in size.

RegExMBS.ConfigMallocThreshold as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Regular Expressions MBS RegEx Plugin 11.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The output is an integer that contains the threshold above which the POSIX interface uses malloc() for output vectors.

RegExMBS.ConfigMatchLimit as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Regular Expressions MBS RegEx Plugin 11.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Returns an integer that gives the default limit for the number of internal matching function calls in a Execute execution.

RegExMBS.ConfigMatchLimitRecursion as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Regular Expressions MBS RegEx Plugin 11.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Returns an integer that gives the default limit for the depth of recursion when calling the internal matching function in a Execute() execution.

RegExMBS.ConfigNewLine as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Regular Expressions MBS RegEx Plugin 11.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
What newline character is used as default.

The output is an integer whose value specifies the default character sequence that is recognized as meaning "newline". The four values that are supported are: 10 for LF, 13 for CR, 3338 for CRLF, -2 for ANYCRLF, and -1 for ANY. Though they are derived from ASCII, the same values are returned in EBCDIC environments. The default should normally correspond to the standard sequence for your operating system.

RegExMBS.ConfigStackRecurse as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Regular Expressions MBS RegEx Plugin 11.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Returns an integer that is set to one if internal recursion when running Execute() is implemented by recursive function calls that use the stack to remember their state.

This is the usual way that PCRE is compiled. The output is zero if PCRE was compiled to use blocks of data on the heap instead of recursive function calls. In this case, malloc and free are called to manage memory blocks on the heap, thus avoiding the use of the stack.

RegExMBS.ConfigUnicodeProperties as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Regular Expressions MBS RegEx Plugin 11.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Returns true if unicode properties are available.

Should be true for the plugin.

RegExMBS.ConfigUTF8 as boolean

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Regular Expressions MBS RegEx Plugin 11.2 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
Whether UTF8 is supported.

If this ever is false, please complain. This plugin is designed to work only on UTF8 strings for best performance.

Some examples using this method:

RegExMBS.Constructor(VecSize as Integer = 0)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method Regular Expressions MBS RegEx Plugin 13.4 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The constructor.

You pass here the internal vector size which limits how many substrings you can find.
For 20 substrings, you need to pass (20+1)*3 for vector size.

The items on this page are in the following plugins: MBS RegEx Plugin.


The biggest plugin in space...