Pattern.Matches 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
多載
| 名稱 | Description |
|---|---|
| Matches(String, ICharSequence) |
編譯給定的正則表達式,並嘗試將給定的輸入與之匹配。 |
| Matches(String, String) |
編譯給定的正則表達式,並嘗試將給定的輸入與之匹配。 |
Matches(String, ICharSequence)
編譯給定的正則表達式,並嘗試將給定的輸入與之匹配。
[Android.Runtime.Register("matches", "(Ljava/lang/String;Ljava/lang/CharSequence;)Z", "")]
public static bool Matches(string regex, Java.Lang.ICharSequence input);
[<Android.Runtime.Register("matches", "(Ljava/lang/String;Ljava/lang/CharSequence;)Z", "")>]
static member Matches : string * Java.Lang.ICharSequence -> bool
參數
- regex
- String
要編譯的表達式
- input
- ICharSequence
要匹配的角色序列
傳回
是否正則表達式在輸入上相符
- 屬性
備註
編譯給定的正則表達式,並嘗試將給定的輸入與之匹配。
此方便方法的引用
<引用>
Pattern.matches(regex, input);
</區塊引用>
行為與表達式
<引用>
Pattern.compile(regex).matcher(input).matches()
</區塊引用>
若一個模式需多次使用,編譯一次並重複使用會比每次都呼叫此方法更有效率。
Java 文件 java.util.regex.Pattern.matches(java.lang.String, java.lang.CharSequence)。
本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。
另請參閱
- <xref:Java.Util.Regex.Pattern.Compile(System.String%2c+Java.Util.Regex.RegexOptions)>
- Matches()
適用於
Matches(String, String)
編譯給定的正則表達式,並嘗試將給定的輸入與之匹配。
public static bool Matches(string regex, string input);
static member Matches : string * string -> bool
參數
- regex
- String
要編譯的表達式
- input
- String
要匹配的角色序列
傳回
是否正則表達式在輸入上相符
備註
編譯給定的正則表達式,並嘗試將給定的輸入與之匹配。
此方便方法的引用
<引用>
Pattern.matches(regex, input);
</區塊引用>
行為與表達式
<引用>
Pattern.compile(regex).matcher(input).matches()
</區塊引用>
若一個模式需多次使用,編譯一次並重複使用會比每次都呼叫此方法更有效率。
Java 文件 java.util.regex.Pattern.matches(java.lang.String, java.lang.CharSequence)。
本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。