Super class: NSRegularExpressionMBS
|class||Cocoa Regular Expressions||MBS MacCocoa Plugin||21.1||✅ Yes||❌ No||❌ No||✅ Yes||All|
// create detector for links and emails
Dim types As Integer = NSTextCheckingResultMBS.NSTextCheckingTypeLink
Dim Error As NSErrorMBS
Dim DataDetector As New NSDataDetectorMBS(types, error)
Dim s As String = "Email us at email@example.com today!"
// look for the links now
Dim m() As NSTextCheckingResultMBS = DataDetector.matches(s, 0)
// show first link
Dim r As NSTextCheckingResultMBS = m(0)
Currently the NSDataDetectorMBS class can match dates, addresses, links, phone numbers and transit information.
(links includes email addresses)
The results of matching content is returned as NSTextCheckingResultMBS objects. However, the NSTextCheckingResultMBS objects returned by NSDataDetectorMBS are different from those returned by the base class NSRegularExpressionMBS. Results returned by NSDataDetector will be of one of the data detectors types, depending on the type of result being returned, and they will have corresponding properties. For example, results of type NSTextCheckingTypeDate have a date, timeZone, and duration; results of type NSTextCheckingTypeLink have a URL, and so forth.
Subclass of the NSRegularExpressionMBS class.
- property checkingTypes as Integer
- 3 methods
- shared method dataDetectorWithTypes(checkingTypes as Integer, byref error as NSErrorMBS) as NSDataDetectorMBS
Super class NSRegularExpressionMBS
- event enumerateMatch(text as String, options as Integer, result as NSTextCheckingResultMBS, flags as Integer, byref stop as Boolean)
- 4 properties
- 10 methods
- method Constructor(script as string, options as Integer, byref error as NSErrorMBS)
- method copy as NSRegularExpressionMBS
- method enumerateMatches(text as string, options as Integer, range as NSRangeMBS = nil)
- method firstMatch(text as string, options as Integer, range as NSRangeMBS = nil) as NSTextCheckingResultMBS
- method matches(text as string, options as Integer, range as NSRangeMBS = nil) as NSTextCheckingResultMBS()
- method numberOfMatches(text as string, options as Integer, range as NSRangeMBS = nil) as Integer
- method rangeOfFirstMatch(text as string, options as Integer, range as NSRangeMBS = nil) as NSRangeMBS
- method replaceMatches(byref text as string, options as Integer, range as NSRangeMBS = nil, template as String) as Integer
- method replacementStringForResult(result as NSTextCheckingResultMBS, text as string, offset as Integer, template as String) as String
- method stringByReplacingMatches(text as string, options as Integer, range as NSRangeMBS = nil, template as String) as String
- 3 shared methods
- 17 constants
Specifies that matches are limited to those at the start of the search range. See enumerateMatches for a description of the constant in context.
Call the Block once after the completion of any matching. This option has no effect for methods other than enumerateMatches. See enumerateMatches for a description of the constant in context.
Call the Block periodically during long-running match operations. This option has no effect for methods other than enumerateMatches. See enumerateMatches for a description of the constant in context.
Specifies that ^ and $ will not automatically match the beginning and end of the search range, but will still match the beginning and end of the entire string. This constant has no effect if the search range contains the entire string. See enumerateMatches for a description of the constant in context.
Specifies that matching may examine parts of the string beyond the bounds of the search range, for purposes such as word boundary detection, lookahead, etc. This constant has no effect if the search range contains the entire string. See enumerateMatches for a description of the constant in context.
Set when the Block is called after matching has completed.
Set when the current match operation reached the end of the search range.
Set when matching failed due to an internal error.
Set when the Block is called to report progress during a long-running match operation.
Set when the current match depended on the location of the end of the search range.
Ignore whitespace and #-prefixed comments in the pattern.
Allow ^ and $ to match the start and end of lines.
Match letters in the pattern independent of case.
Allow . to match any character, including line separators.
Treat the entire pattern as a literal string.
Use Unicode TR#29 to specify word boundaries (otherwise, traditional regular expression word boundaries are used).
Treat only \n as a line separator (otherwise, all standard line separators are used).
This class has no sub classes.
Some methods using this class:
- NSRegularExpressionMBS.regularExpressionWithPattern(pattern as String, options as Integer, byref error as NSErrorMBS) as NSDataDetectorMBS
Some examples using this class:
- Video about MBS Xojo Plugins 21.1
- MonkeyBread Software Releases the MBS Xojo Plugins in version 21.1
- MBS Xojo Plugins, version 21.1pr6
- Data Detectors for Xojo
The items on this page are in the following plugins: MBS MacCocoa Plugin.
MBS Xojo Plugins