Freigeben über


String.Matches(String) Method

Definition

Tells whether or not this string matches the given regular expression.

[Android.Runtime.Register("matches", "(Ljava/lang/String;)Z", "")]
public bool Matches (string regex);
[<Android.Runtime.Register("matches", "(Ljava/lang/String;)Z", "")>]
member this.Matches : string -> bool

Parameters

regex
String

the regular expression to which this string is to be matched

Returns

true if, and only if, this string matches the given regular expression

Attributes

Exceptions

if regularExpression == null

Remarks

Tells whether or not this string matches the given regular expression.

An invocation of this method of the form str.matches(regex) yields exactly the same result as the expression

<blockquote> java.util.regex.Pattern.java.util.regex.Pattern#matches(String,CharSequence) matches(<i>regex</i>, <i>str</i>)</blockquote>

Added in 1.4.

Java documentation for java.lang.String.matches(java.lang.String).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to