Home Cooker Classes Others Rice CookerGX
Classes  >  regex  >  Match(string)
regex class : Match(string) method

Description

Gets a first substring in the input string which matches with the regular expression.

Syntax

regexInstance.Match(string source)

Arguments

ClassNameDescription
stringsourceA string which is searched.

Return value

ClassDescription
stringA first substring in the input string which matches with the regular expression.

Sample code

//anyRegex is an any instance of regex type.

regex anyRegex = new regex("(a+)");

string match = anyRegex.Match("aaabbbaaccc");

Notes

It's a wrapper of the System.Text.RegularExpressions.Regex.Match(String).

If no match is found, return value is empty string.

Links for reference

Copyright © Rice All rights reserved.