match class : Value getter

Description

Gets a matching substring.

Syntax

matchInstance.Value

Arguments

None

Return value

ClassDescription
stringA matching substring.

Sample code

1:

regex pattern = new regex("(b+)");

2:

match firstMatch= pattern.MatchM("aaabbbaaccc"); // success

3:

string subStr = firstMatch.Value; // "bbb"。

4:

pattern = new regex("(d+)");

5:

firstMatch= pattern.MatchM("aaabbbaaccc"); // failure

6:

subStr = firstMatch.Value; // ""。

Notes

It's a wrapper of the System.Text.RegularExpressions.Match.Value property.

If the match is successful, the matched substring is returned.

If the match is failure, an empty string is returned.

Links for reference

Copyright © Cooker All rights reserved.