|Type||Topic||Plugin||Version||macOS||Windows||Linux||Console & Web||iOS|
|class||Regular Expressions||MBS Tools Plugin||6.2||Yes||Yes||Yes||Yes||No|
dim r as new RegExMBS
dim searchString as string = ".o"
if r.Compile(searchString) then
dim s as string="Hello World"
dim start as Integer = 0
dim p as Integer = r.OffsetCharacters(0)
dim l as Integer = r.OffsetCharacters(1)-r.OffsetCharacters(0)
MsgBox "Found "+searchString+" on position "+str(p)+" with length "+str(l)+" in """+s+""""
start = r.Offset(1)
MsgBox "failed to compile"
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 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
- 26 constants
This error is given if the value of the ovecsize argument is negative.
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.
An invalid combination of Newline options was given.
The value of startoffset was negative or greater than the length of the subject, that is, the value in length.
An unrecognized bit was set in the options argument.
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.
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.
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.
An unexpected internal error has occurred. This error could be caused by a bug in PCRE or by overwriting of the compiled pattern.
The backtracking limit, as specified by the match_limit field in a pcre_extra structure (or defaulted) was reached.
The subject string did not match the pattern.
This error is used by the substring functions.
Either code or subject was passed as "", or ovector was "" and ovecsize was not zero.
The subject string did not match, but it did match partially.
Generic error for something wrong with the plugin state.
Like no current regex object internally or wrong function parameters.
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.
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.
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 which use this class:
- /Tools/RegEx/RegEx Multiline
- /Tools/RegEx/RegEx Speed Test
- /Tools/RegEx/Test RegEx1
- /Tools/RegEx/Test RegEx2
- Problems with killing Xojo threads with plugin calls.
- MBS Xojo / Real Studio Plugins, version 16.0pr6
- MBS Xojo / Real Studio Plugins, version 15.1pr4
- MBS Xojo / Real Studio Plugins, version 15.1pr1
- MBS Xojo / Real Studio Plugins, version 14.4pr7
- Mac App Store submission and RegEx Plugin
- MBS Xojo / Real Studio plug-ins in version 13.4
- MBS Xojo / Real Studio Plugins, version 13.4pr4
- MBS Xojo / Real Studio Plugins, version 13.4pr2
- MBS Real Studio Plugins, version 13.1pr7
The items on this page are in the following plugins: MBS Tools Plugin.
MBS Xojo Plugins