MatchMatch — a convenience function that combines calls to Compile, Study, and
Exec.
static Regex.Match(pattern, subject, options?=0,
length?=-1, startoffset?=0)
patternA string specifying the regular expression pattern.
subjectThe subject string on which to apply the pattern. This may be
either a string or a buffer. If the subject is a buffer it may
contain NUL characters.
optionsOption flags - a bitwise OR of zero or more of these flags:
PCRE_ANCHORED |
PCRE_BSR_ANYCRLF |
PCRE_BSR_UNICODE |
PCRE_CASELESS |
PCRE_DOLLAR_ENDONLY |
PCRE_DOTALL |
PCRE_DUPNAMES |
PCRE_EXTENDED |
PCRE_EXTRA |
PCRE_FIRSTLINE |
PCRE_JAVASCRIPT_COMPAT |
PCRE_MULTILINE |
PCRE_NEWLINE_ANY |
PCRE_NEWLINE_ANYCRLF |
PCRE_NEWLINE_CR |
PCRE_NEWLINE_CRLF |
PCRE_NEWLINE_LF |
PCRE_NOTBOL |
PCRE_NOTEMPTY |
PCRE_NOTEMPTY_ATSTART |
PCRE_NOTEOL |
PCRE_NO_AUTO_CAPTURE |
PCRE_NO_START_OPTIMIZE |
PCRE_NO_UTF8_CHECK |
PCRE_PARTIAL_HARD |
PCRE_PARTIAL_SOFT |
PCRE_UNGREEDY |
PCRE_UTF8 |
lengthThe length of the subject, in bytes. If length is
-1 (the default), the length of the subject
string is computed automatically.
startoffsetA byte offset into the subject specifying at which point to start.
On success, an array of match specifications equivalent to the substrings
argument to Regex.Exec. On failure, an error list with
three elements:
Find and return all matches of hello, case sensitive:
Gamma>Regex.Match ("(hello)", "I say Hello and you say Goodbye");(-1 0 "No match found")
Find and return all matches of hello, case insensitive:
Gamma>Regex.Match ("(hello)", "I say Hello and you say Goodbye", PCRE_CASELESS);[[0 31 #{I say Hello and you say Goodbye}] [6 11 #{Hello}]]