Previous Index Next

BridgePlus.framework, SMSForder Class Methods

Category

Regular Expression methods

Method

findMatches:inString:options:

Summary

Returns an array of the matching strings found. If none found, returns an empty array.

Signature

+ (NSArray *)findMatches:(NSString *)regexPattern inString:(NSString *)searchString options:(NSString *)optionsString

Parameters

regexPattern = ICY regular expression pattern; see http://userguide.icu-project.org/strings/regexp.

searchString = string to search

optionsString = a string containing any or all of the following letters:

i Makes the search case insensitive

x Allows white space and #comments in the pattern

s Makes the "." character match a line terminator

m Makes "^" and "$" match the start/end of every line, not just the whole string

w Makes \b match word boundaries as described in Unicode UAX 29, rather than traditional regular expression behavior

Result

Array of found strings.

Availability

Version 1.0.0

Notes

 

Sample

use scripting additions

use framework "Foundation"

use script "BridgePlus"

load framework


set aString to "The cat sat in the cot"

set theResult to current application's SMSForder's findMatches:"c.t" inString:aString options:""

ASify from theResult

--> {"cat", "cot"}

theResult as list -- only in 10.10 and later

--> {"cat", "cot"}


set theResult to current application's SMSForder's findMatches:"th." inString:aString options:""

ASify from theResult

--> {"the"}

theResult as list

--> {"the"}


set theResult to current application's SMSForder's findMatches:"th." inString:aString options:"i"

ASify from theResult

--> {"The", "the"}

theResult as list

--> {"The", "the"}


Click here to open script in a script editor