Platforms to show: All Mac Windows Linux Cross-Platform
RegExMBS class
Type | Topic | Plugin | Version | macOS | Windows | Linux | iOS | Targets |
class | Regular Expressions | MBS RegEx Plugin | 6.2 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | All |
uses the PCRE library. You may check the PCRE documentation.
The RegExMBS class has different defaults as the built in RegEx class in Xojo.
You may want to set options like this:
RB: CaseSensitive = false
MBS: CompileOptionCaseLess = true
RB: DotMatchAll = false
MBS: CompileOptionDotAll = false
RB: Greedy = true
MBS: CompileOptionUngreedy = false
RB: LineEndType = 0
MBS: CompileOptionNewLineAnyCRLF = true and ExecuteOptionNewLineAnyCRLF = true
RB: MatchEmpty = true
MBS: ExecuteOptionNotEmpty = false
and you want to set CompileOptionMultiline to true for multi line match.
- 55 properties
- property CompileOptionAnchored as Boolean
- property CompileOptionAutoCallOut as Boolean
- property CompileOptionBSRAnyCRLF as Boolean
- property CompileOptionBSRUnicode as Boolean
- property CompileOptionCaseLess as Boolean
- property CompileOptionDollarEndOnly as Boolean
- property CompileOptionDotAll as Boolean
- property CompileOptionDuplicateNames as Boolean
- property CompileOptionExtended as Boolean
- property CompileOptionFirstLine as Boolean
- property CompileOptionJavaScriptCompat as Boolean
- property CompileOptionMultiline as Boolean
- property CompileOptionNewLineAny as Boolean
- property CompileOptionNewLineAnyCRLF as Boolean
- property CompileOptionNewLineCR as Boolean
- property CompileOptionNewLineCRLF as Boolean
- property CompileOptionNewLineLF as Boolean
- property CompileOptionNoAutoCapture as Boolean
- property CompileOptionNoStartOptimize as Boolean
- property CompileOptionNoUTF8Check as Boolean
- property CompileOptions as Integer
- property CompileOptionUngreedy as Boolean
- property CompileOptionUnicodeCodePoints as Boolean
- property CompileOptionUTF8 as Boolean
- property Count as Integer
- property ErrorMessage as String
- property ErrorOffset as Integer
- property ExecuteOptionAnchored as Boolean
- property ExecuteOptionBSRAnyCRLF as Boolean
- property ExecuteOptionBSRUnicode as Boolean
- property ExecuteOptionNewLineAny as Boolean
- property ExecuteOptionNewLineAnyCRLF as Boolean
- property ExecuteOptionNewLineCR as Boolean
- property ExecuteOptionNewLineCRLF as Boolean
- property ExecuteOptionNewLineLF as Boolean
- property ExecuteOptionNoStartOptimize as Boolean
- property ExecuteOptionNotBOL as Boolean
- property ExecuteOptionNotEmpty as Boolean
- property ExecuteOptionNotEmptyAtStart as Boolean
- property ExecuteOptionNotEOL as Boolean
- property ExecuteOptionNoUTF8Check as Boolean
- property ExecuteOptionPartial as Boolean
- property ExecuteOptionPartialHard as Boolean
- property ExecuteOptions as Integer
- property Handle as Integer
- property InfoCaptureCount as Integer
- property InfoNameCount as Integer
- property InfoSize as Integer
- property InfoStudySize as Integer
- property Lasterror as Integer
- property MatchLimit as Integer
- property MatchLimitRecursion as Integer
- property Text as String
- property TextMemory as Memoryblock
- property VectorSize as Integer
- 34 methods
- method Compile(pattern as string) as boolean
- method CompileMemory(pattern as memoryblock, ByteOffset as Integer) as boolean
- method ConfigBSR as boolean
- method ConfigLinkSize as Integer
- method ConfigMallocThreshold as Integer
- method ConfigMatchLimit as Integer
- method ConfigMatchLimitRecursion as Integer
- method ConfigNewLine as Integer
- method ConfigStackRecurse as boolean
- method ConfigUnicodeProperties as boolean
- method ConfigUTF8 as boolean
- method Constructor(VecSize as Integer = 0)
- method Escape(text as string) as string
- method Execute(start as Integer = 0) as Integer
- method Execute(text as string, start as Integer = 0) as Integer
- method ExecuteMemory(text as memoryblock, ByteOffset as Integer = 0, ByteLength as Integer = 0) as Integer
- method ExecuteMemoryMT(text as memoryblock, ByteOffset as Integer = 0, ByteLength as Integer = 0) as Integer
- method ExecuteMT(start as Integer = 0) as Integer
- method ExecuteMT(text as string, start as Integer = 0) as Integer
- method InfoNameEntry(Index as Integer) as string
- method Match(text as string) as boolean
- method Match(text() as string, inverse as boolean = false) as string()
- method Match(text() as Variant, inverse as boolean = false) as string()
- method Offset(index as Integer) as Integer
- method OffsetCharacters(index as Integer) as Integer
- method Replace(NewText as string) as string
- method ReplaceAll(Target as string, NewText as string = "") as string
- method ReplaceSelection(NewText as string) as string
- method StringNumber(name as string) as Integer
- method Study as boolean
- method Substring(index as Integer) as string
- method Substring(name as string) as string
- method Unescape(text as string) as string
- method Version as string
- shared method IsASCIIText(text as string) as boolean
- 26 constants
Error Constants
Constant | Value | Description |
---|---|---|
ErrorBadCount | -15 |
This error is given if the value of the ovecsize argument is negative. |
ErrorBadMagic | -4 |
PCRE stores a 4-byte "magic number" at the start of the compiled code, to catch the case when it is passed a junk pointer and to detect when a pattern that was compiled in an environment of one endianness is run in an environment with the other endianness. This is the error that PCRE gives when the magic number is not present. |
ErrorBadNewLine | -23 |
An invalid combination of Newline options was given. |
ErrorBadOffset | -24 |
The value of startoffset was negative or greater than the length of the subject, that is, the value in length. |
ErrorBadOption | -3 |
An unrecognized bit was set in the options argument. |
ErrorBadPartial | -13 |
This code is no longer in use. It was formerly returned when the PCRE_PARTIAL option was used with a compiled pattern containing items that were not supported for partial matching. From release 8.00 onwards, there are no restrictions on partial matching. |
ErrorBadUTF8 | -10 |
A string that contains an invalid UTF-8 byte sequence was passed as a subject. However, if PCRE_PARTIAL_HARD is set and the problem is a truncated UTF-8 character at the end of the subject, ErrorShortUTF8 is used instead. |
ErrorBadUTF8Offset | -11 |
The UTF-8 byte sequence that was passed as a subject was valid, but the value of startoffset did not point to the beginning of a UTF-8 character or the end of the subject. |
ErrorCallOut | -9 | |
ErrorDFARecurse | -20 | |
ErrorDFAUCond | -17 | |
ErrorDFAUItem | -16 | |
ErrorDFAUMLimit | -18 | |
ErrorDFAWSSize | -19 | |
ErrorInternal | -14 |
An unexpected internal error has occurred. This error could be caused by a bug in PCRE or by overwriting of the compiled pattern. |
ErrorMatchLimit | -8 |
The backtracking limit, as specified by the match_limit field in a pcre_extra structure (or defaulted) was reached. |
ErrorNoMatch | -1 |
The subject string did not match the pattern. |
ErrorNoSubstring | -7 |
This error is used by the substring functions. |
ErrorNull | -2 |
Either code or subject was passed as "", or ovector was "" and ovecsize was not zero. |
ErrorNullWSLimit | -22 | |
ErrorPartial | -12 |
The subject string did not match, but it did match partially. |
ErrorPlugin | -99 |
Generic error for something wrong with the plugin state. Like no current regex object internally or wrong function parameters. |
ErrorRecursionLimit | -21 |
The internal recursion limit, as specified by the match_limit_recursion field in a pcre_extra structure (or defaulted) was reached. See the description above. |
ErrorShortUTF8 | -25 |
The subject string ended with an incomplete (truncated) UTF-8 character, and the PCRE_PARTIAL_HARD option was set. Without this option, ErrorBadUTF8 is returned in this situation. |
ErrorUnknownNode | -6 | |
ErrorUnknownOpcode | -5 |
While running the pattern match, an unknown item was encountered in the compiled pattern. This error could be caused by a bug in PCRE or by overwriting of the compiled pattern. |
This class has no sub classes.
Some examples using this class:
- /RegEx/PCRE2/PCRE2 Speed Test
- /RegEx/RegEx/RegEx Multiline
- /RegEx/RegEx/RegEx Speed Test
- /RegEx/RegEx/RegExMBS
- /RegEx/RegEx/Test RegEx1
- /RegEx/RegEx/Test RegEx2
Blog Entries
- The Top 10 from the MBS Xojo Plugins in 2022
- News from the MBS Xojo Plugins Version 22.2
- Iterate with PCRE2
- New PCRE2 Plugin for Xojo
- RegEx Speedup
- Multithreaded plugin functions can increase speed of Xojo application
- Problems with killing Xojo threads with plugin calls.
- Mac App Store submission and RegEx Plugin
- MBS Xojo / Real Studio plug-ins in version 13.4
- RegEx Speed Test
Xojo Developer Magazine
- 21.1, page 27: News from MBS Xojo Plugins, What's up with MonkeyBread Software by Stefanie Juchmes
- 12.4, page 73: Eureka!, Tips and Tricks for the Xojo Developer by Markus Winter
- 12.3, page 91: Group-Ease (and Subgroup-Ease), Everything You Need To Know About Subgroups by Kem Tekinay
- 11.6, page 8: News
Release notes
- Version 21.1
- Version 20.0
- Fixed crash in SubString() function in RegExMBS when called without an Execute first. Raising exceptions now in this case.
The items on this page are in the following plugins: MBS RegEx Plugin.
RectControl - RegistrationEngineMBS