Share via


Pattern 類別

定義

正則表達式的編譯表示。

[Android.Runtime.Register("java/util/regex/Pattern", DoNotGenerateAcw=true)]
public sealed class Pattern : Java.Lang.Object, IDisposable, Java.Interop.IJavaPeerable, Java.IO.ISerializable
[<Android.Runtime.Register("java/util/regex/Pattern", DoNotGenerateAcw=true)>]
type Pattern = class
    inherit Object
    interface ISerializable
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
繼承
Pattern
屬性
實作

備註

正則表達式的編譯表示法。

指定為字串的正則表達式,必須先編譯為這個類別的實例。 然後,產生的模式可用來建立 Matcher 物件,以符合正則表達式的任意 java.lang.CharSequence 字元序列。 執行比對所涉及的所有狀態都位於比對器中,因此許多比對者可以共用相同的模式。

因此,典型的調用序列

<blockquote>

Pattern p = Pattern.{@link #compile compile}("a*b");
            Matcher m = p.{@link #matcher matcher}("aaaaab");
            boolean b = m.{@link Matcher#matches matches}();

</blockquote>

#matches matches 正則表達式只使用一次時,這個類別會定義方法作為便利性。 這個方法會編譯表達式,並在單一調用中針對它比對輸入序列。 陳述式

<blockquote>

boolean b = Pattern.matches("a*b", "aaaaab");

</blockquote>

與上述三個語句相等,不過針對重複的相符專案,則效率較低,因為它不允許重複使用編譯的模式。

這個類別的實例不可變,而且可供多個並行線程使用。 類別 Matcher 的實例對於這類使用並不安全。

<h2>“sum”>summary of regular-expression constructs</h2>

<table class=“borderless”><標題 style=“display:none”>Regular expression constructs, and what< match/標題<> thead style=“text-align:left”tr<>th id=“construct>”><construct</th><id=“matchs”>Matchs</th></tr></thead><tbody style=“text-align:left”>

<tr><th colspan=“2” style=“padding-top:20px” id=“characters”>Characters</th></tr>

<tr><th style=“vertical-align:top; font-weight: normal” id=“x”>x</th<>td headers=“matches characters x”>The character x</td></tr th><><style=“vertical-align:top; font-weight: normal” id=“backslash”>\\</th><td headers=“符合字元反斜杠”>The backslash character</td></tr tr><><th style=“vertical-align:top; font-weight: normal” id=“octal_n”>\0n</th><td headers=“會比對字元octal_n”>具有八進位值的0字元 n (0  <=n <= 7) </td></tr><th><style=“vertical-align:top; font-weight: normal” id=“octal_nn”>\0nn</th><td headers=“符合字符octal_nn”>具有八進位值的0字符 nn (0  <=n <= 7) </td></tr<>th><style=“vertical-align:top; font-weight: normal” id=“octal_nnn”>\0mnn/th<>td headers=“符合字符octal_nnn”>具有八進位值的0字符 mnn< (0 <= ;m <= 3, 0 <= n <= 7) </td></tr><th><style=“vertical-align:top; font-weight: normal” id=“hex_hh”\x>hh</th><td headers=“符合字符hex_hh”>具有十六進位值的0x字元 hh</td/tr th<>><style=“vertical-align:top; font-weight: normal” id=“hex_hhhh”>&#92;uhhhh</th<>td>< headers=“matches characters hex_hhhh”>具有十六進位  的字元;value 0xhhhh</td></tr><tr><th style=“vertical-align:top; font-weight: normal” id=“hex_h_h”>&#92;x{h...h}</th><td headers=“符合字元hex_h_h”>具有十六進位值的0x字元 h...h (&java.lang.Character#MIN_CODE_POINT Character.MIN_CODE_POINT nbsp;<= 0xH。。。h <= ) /td></tr<>th><style=“vertical-align:top; font-weight: normal” id=“unicode_name”>&#92;N{name}</><th td headers=“符合字元unicode_name”>具有 Unicode 字符名稱 'name'</td></tr tr><><th style=“vertical-align:top; font-weight:normal” id=“tab”<\t>/th<>td headers=“符合字符索引卷標java.lang.Character#MAX_CODE_POINT Character.MAX_CODE_POINT<“>tab 字元 ('&#92;u0009') </td></tr tr><><th style=”vertical-align:top; font-weight:normal“ id=”newline“>\n</th><td headers=”matches characters newline“>The newline (line feed) character '&#92;u000A' () </td></tr th><><style=”vertical-align:top; font-weight:normal“ id=”return“>\r</th><td headers=”matches characters return“>歸位字元 () '&#92;u000D' /td></tr th><><style=“vertical-align:top; font-weight:normal” id=“form_feed”<>\f/th<>td headers=“符合字元form_feed”>窗體摘要字元 ('&#92;u000C') </td></tr<>tr><th style=“vertical-align:top; font-weight:normal” id=“bell”><\a/th<>td headers=“matches characters bell”><警示 (鈴) 字元 '&#92;u0007'< () /td/tr tr<>><th style=“vertical-align:top; font-weight:normal” id=“escape”<>\e/th<>td headers=“matches character escape”>the escape character '&#92;u001B' () </td></tr tr>><<th style=“vertical-align:top; font-weight:normal” id=“ctrl_x”\c>x</th><td>< headers=“matches characters ctrl_x”>對應至 x</td></tr 的控制字元>

<tr><th colspan=“2” style=“padding-top:20px” id=“classs”>Character classs</th></tr>

<tr><th style=“vertical-align:top; font-weight:normal” id=“simple”>[abc]</th><td headers=“matches classs simple”>ab, or c (simple class <) /td></tr><><th style=“vertical-align:top; font-weight:normal” id=“negation”>[^abc]</th<>td headers=“matches classs negation”>any character except abor (c negation <) /td></tr tr><><th style=“vertical-align:top;font-weight:normal“ id=”range“><[a-zA-Z]/th><td headers=”matches classs range“a> 到 ZAz ,包含 (range) </td></tr><><th style=”vertical-align:top; font-weight:normal“ id=”union“>[a-d[m-p]]</th><td headers=”matches classs union“>ad,或m透過 p[a-dm-p] (union) </td></tr><><th style=“vertical-align:top;font-weight:normal“ id=”intersection“><[a-z&&[def]]/th><td headers=”符合類別交集“d>, ef (交集) </tr><th><style=”vertical-align:top; font-weight:normal“ id=”subtraction1“>[a-z&&[^bc]]</th><td headers=”matches classs subtraction1“>az,但 和 cb 除外: [ad-z] (減法) </td></tr><><th style=“vertical-align:top;font-weight:normal“ id=”subtraction2“><[a-z&&[^m-p]]/th<>td headers=”比對類別減法2“a>,z而不是m透過 p[a-lq-z] (減法) </td></tr>

<tr><th colspan=“2” style=“padding-top:20px” id=“predef”>Predefined character classs</th></tr>

<tr><th style=“vertical-align:top; font-weight:normal” id=“any”><./th><td headers=“matchs predef any”>Any character (may or may not match line terminators) </td></tr tr<>><th style=“vertical-align:top; font-weight:normal” id=“digit”>\d</th<>td headers=“matches predef digit”>A digit: \p{IsDigit}</td></tr tr><><th style=“vertical-align:top; font-weight:normal” id=“non_digit”>\D</th>td headers=“符合 predef non_digit”>A non-digit: [^\d]</td></tr tr<>><th style=“vertical-align:top; font-weight:normal” id=“horiz_white”>\h</th><td headers=“matches predef horiz_white”>A horizontal whitespace character:<[ \t\xA0&#92;u1680&#92;u180e&#92;u2000-&#92;u200a&#92;u202f&#92;u205f&#92;u3000] /td></tr tr><<>th style=“vertical-align:top; font-weight:normal” id=“non_horiz_white”>\H</th<>td headers=“matches predef non_<horiz_white“>非水準空格符:<[^\h] /td></tr tr><><th style=”vertical-align:top; font-weight:normal“ id=”white“>\s</th><td headers=”matches predef white“>A whitespace character: \p{IsWhite_Space}</td></tr tr><><th style=”vertical-align:top; font-weight:normal“ id=”non_white“>\S</th><td headers=”matches predef non_white“>A non-whitespace character:[^\s]</td></tr><tr><th style=“vertical-align:top; font-weight:normal” id=“vert_white”>\v</th><td headers=“符合 predef vert_white”>A vertical whitespace character:[\n\x0B\f\r\x85&#92;u2028&#92;u2029]< /td></tr><tr><th style=“vertical-align:top; font-weight:normal” id=“non_vert_white”>\V</th><td headers=“matches predef non_vert_white”>非垂直空格符: [^\v]</td></Tr><tr><th style=“vertical-align:top; font-weight:normal” id=“word”><\w/th><td headers=“matches predef word”>A word character: [\p{alpha\p{gc=Mark}\p{digit}\p{gc=Connector_Punctuation}\p{Join_Control}]}</td></tr tr><><th style=“vertical-align:top; font-weight:normal” id=“non_word”>\W</th<>td headers=“matches predef non_word”>A non-word character: [^\w]</td></Tr>

<tr><th colspan=“2” style=“padding-top:20px” id=“posix”><b>POSIX 字符類別 (Unicode 感知) </b></th></tr>

<tr><th style=“vertical-align:top; font-weight:normal” id=“Lower”>\p{Lower}/th><td headers=“matches posix Lower”>A小寫字母字符: \p{IsLowercase}</td></tr<>tr><th style=“vertical-align:top; font-weight:normal” id=“Upper”\p{Upper>}<</th><td headers=“matches posix Upper”>An upper-case 字母字符:\p{IsUppercase}</td></tr tr><><th style=“vertical-align:top; font-weight:normal“ id=”ASCII“>}/th><td headers=”matches posix ASCII“>All ASCII:[\x00-\x7F]</td></tr tr><<>th style=”vertical-align:top; font-weight:normal“ id=”Alpha“>\p{Alpha}</th><td headers=”matches posix Alpha“>An alphabetic character:[\p{IsAlphabetic]}</td></tr tr><<>th style=”vertical-align:top; font-weight:normal“ id=”Digit“>\p{IsDigit}</th><td headers=”matches posix Digit”<\p{ASCII>十進位數: \p{gc=Decimal_Number}</td></tr><th><style=“vertical-align:top; font-weight:normal” id=“Alnum”\p{Alnum>}</th><td headers=“matches posix Alnum”>An alphanumeric character:[\p{Alpha\p{Digit}]}</td></tr tr>><<th style=“vertical-align:top; font-weight:normal” id=“Punct”>\p{Punct}</th<>td headers=“matches posix Punct”>Punctuation: \p{IsPunctuation}</td></tr tr><><th style=“vertical-align:top;font-weight:normal“ id=”Graph“>}/th><td headers=”matches posix Graph“>A visible character: [^p{space\p{gc=Control}\p{gc=Surrogate}\p{gc=Unassigned}]}</td></tr tr><><th style=”vertical-align:top; font-weight:normal“ id=”Print“\p{Print>}</th><td headers=”matches posix Print“>A printable character: [\p{Graph\p{Blank}&&[^\p{Cntrl}]]}</td></tr tr>><<<\p{Graphth style=“vertical-align:top;font-weight:normal“ id=”Blank“>}/th><td headers=”matches posix Blank“>A space or a tab: [\p{gc=Space_Separator\N{CHARACTER TABULATION}]}</td></tr tr><<>th style=”vertical-align:top; font-weight:normal“ id=”Cntrl“>\p{Cntrl}</th><td headers=”matches posix Cntrl“>A control character: \p{gc=Control}</td></tr tr><<>th style=”vertical-align:top; font-weight:normal“ id=”XDigit<\p{Blank“>}/th><td headers=”符合 posix XDigit“>十六進位數位: [\p{gc=Decimal_Number\p{IsHex_Digit}]}</td></tr tr><><th style=”vertical-align:top; font-weight:normal“ id=”Space“>\p{Space}</th<>td headers=”matches posix Space“>A whitespace character: \p{IsWhite_Space}</td></tr tr>><<th style=”vertical-align:top; font-weight:normal“ id=”PosixCompatible“><\p{XDigitPOSIX-Compatible expression</th><td headers=“matches posix PosixCompatible”>請參閱 Unicode 檔</td></tr>

<tr><th colspan=“2” style=“padding-top:20px” id=“java”>java.lang.Character 類別 (簡單的 java 字符類型) </th></tr>

<tr><th style=“vertical-align:top; font-weight:normal” id=“javaLowerCase”>\p{javaLowerCase}</th><td headers=“符合 java javaLowerCase”>相當於 java.lang.Character.isLowerCase () </td></tr tr><><th style=“vertical-align:top; font-weight:normal” id=“javaUpperCase”>\p{javaUpperCase}</th><td headers=“符合 java java javaUpperCase”>相當於 java.lang.Character.isUpperCase () </td></tr tr><><th style=“vertical-align:top;font-weight:normal“ id=”javaWhitespace“>}/th<>td headers=”符合 java javaWhitespace“>相當於 java.lang.Character.isWhitespace () </td></tr<>tr><th style=”vertical-align:top; font-weight:normal“ id=”javaMirrored“\p{javaMirrored>}</th><td headers=”符合 java javaMirrored“>相當於 java.lang.Character.isMirrored () </td></tr<\p{javaWhitespace>

<tr><th colspan=“2” style=“padding-top:20px” id=“unicode”>類別適用於 Unicode 腳本、區塊、類別和二進位屬性</th></tr>

<tr><th style=“vertical-align:top; font-weight:normal” id=“IsLatin”>\p{IsLatin}</th><td headers=“matches unicode IsLatin”>A Latin 腳本字元 (腳本) </td></tr th><><style=“vertical-align:top; font-weight:normal” id=“InGreek”>\p{InGreek}</th><td headers=“符合希臘文  中的 unicode InGreek”>字元;block (block) /td/tr th><<>style=“vertical-align:top; font-weight:normal” id=“Lu”>\p{Lu}</th><td headers=“matches unicode Lu”>An uppercase letter (category) </td></tr><th><style=“vertical-align:top; font-weight:normal” id=“IsAlphabetic”\p{IsAlphabetic>}</th><td headers=“matches unicode IsAlphabetic”>an alphabetic character (binary property) </td></tr><<tr><th style=“vertical-align:top; font-weight:normal” id=“Sc”\p{Sc>}</th><td headers=“matches unicode Sc”>A currency symbol</td></tr<>th><style=“vertical-align:top; font-weight:normal” id=“not_InGreek”\P{InGreek>}</th><td headers=“符合 unicode not_InGreek”>除了希臘 (<區塊中的一個字符以外,) /td></tr<><>><th style=“vertical-align:top;font-weight:normal“ id=”not_uppercase“>[\p{L&&[^\p{Lu}]]}</th<>td headers=”符合 unicode not_uppercase“>除了大寫字母以外的任何字母 (減法) </td></tr>

<tr><th colspan=“2” style=“padding-top:20px” id=“bounds”>Boundary matchers</th></tr>

<tr><th style=“vertical-align:top; font-weight:normal” id=“begin_line”>^</th><td headers=“matches bounds begin_line”>line</td></tr tr th><><style=“vertical-align:top; font-weight:normal” id=“end_line”>$</th><td headers=“符合界限end_line”>line</td></tr tr><><th style=“vertical-align:top; font-weight:normal” id=“word_boundary”>\b</th<>td headers=“符合界限word_boundary”>文字界限</td></tr th<>><style=“vertical-align:top; font-weight:normal” id=“non_word_boundary”\B></th<>td headers=“符合界限non_word_boundary”>A non-word boundary</td/tr tr<>><th style=“vertical-align:top; font-weight:normal” id=“begin_input”\A></th<>td>< headers=“matches boundsbegin_input“>input/td/tr tr th><style=”vertical-align:top; font-weight:normal“ id=”end_prev_match“>\G</th><td headers=”matchs bounds end_prev_match“>前一個 match</td><></tr><tr<>th><style=”vertical-align:top; font-weight:normal“ id=”end_input_except_term“>\Z</th<>td headers=”matchs bounds end_input_except_term“><輸入結尾,但如果 ,則為最終終止符;any</td></tr tr><><th style=“vertical-align:top; font-weight:normal” id=“end_input”>\z</th><td headers=“matches bounds end_input”>input</td></tr 的結尾>

<tr><th colspan=“2” style=“padding-top:20px” id=“linebreak”>Linebreak matcher</th></tr>

<tr><th style=“vertical-align:top; font-weight:normal” id=“any_unicode_linebreak”<\R>/th><td headers=“matches linebreak any_unicode_linebreak”>Any Unicode linebreak sequence, is &#92;u000D&#92;u000A|[&#92;u000A&#92;u000B&#92;u000C&#92;u000D&#92;u0085&#92;u2028&#92;u2029] <to /td></tr>

<tr><th colspan=“2” style=“padding-top:20px” id=“grapheme”>Unicode Extended Grapheme matcher</th></tr>

<tr><th style=“vertical-align:top; font-weight:normal” id=“grapheme_any”>\X</th<>td headers=“matches grapheme grapheme_any”>Any Unicode extended grapheme cluster</td></tr>

<tr><th colspan=“2” style=“padding-top:20px” id=“gredy”>Gredy 數量值</th></tr>

<tr><th style=“vertical-align:top; font-weight:normal” id=“greedy_once_or_not”>X?</th><td headers=“matchesgredy greedy_once_or_not”>X, once or not at all</td></tr<>tr><th style=“vertical-align:top; font-weight:normal” id=“greedy_zero_or_more”>X/th><td headers=“matchesgredy greedy_zero_or_more”>X*<, zero 或 more times</td></tr><tr><th style=“vertical-align:top; font-weight:normal” id=“greedy_one_or_more”>X+</th><td headers=“matchesgredy greedy_one_or_more”>X, one 或 more times</td></tr tr<>th><style=“vertical-align:top; font-weight:normal” id=“greedy_exactly”>X{n}</th><td headers=“符合gredy greedy_exactly”>X, exactly n times</td></tr><th><style=“vertical-align:top; font-weight:normal” id=“greedy_at_least”>X{n,}</th<>td headers=“matchesgredy greedy_at_least”>X, 至少 n times</td></tr tr><><th style=“vertical-align:top; font-weight:normal” id=“greedy_at_least_up_to”>X{ n, m<}/th><td headers=“符合窮盡greedy_at_least_up_to”>X,至少 n 個但不超過 m 次</td></tr>

<tr><th colspan=“2” style=“padding-top:20px” id=“reluc”>配量值</th></tr>

<tr><th style=“vertical-align:top; font-weight:normal” id=“reluc_once_or_not”>X??</th><td headers=“matches reluc reluc_once_or_not”>X, once or not at all</td></tr><tr><th style=“vertical-align:top; font-weight:normal” id=“reluc_zero_or_more”>X*?</th<>td headers=“matches reluc reluc_zero_or_more”>X, zero 或 more times</td></tr><><th style=“vertical-align:top;font-weight:normal“ id=”reluc_one_or_more“>X+?</th><td headers=”matches reluc reluc_one_or_more“>X, one 或多次</td></tr><tr><th style=”vertical-align:top; font-weight:normal“ id=”reluc_exactly“>X{n}?</th><td headers=”matches reluc reluc_exactly“>X, exactly n times</td></tr><><th style=“vertical-align:top;font-weight:normal“ id=”reluc_at_least“>X{n,}?</th<>td headers=”matches reluc reluc_at_least“>X, 至少 n times</td/tr tr<><>th style=”vertical-align:top; font-weight:normal“ id=”reluc_at_least_up_to“>X{ n, m<}?/th<>td>< headers=”matches reluc reluc_at_least_up_to“>X, 至少 n但不超過 m 次</td></tr>

<tr><th colspan=“2” style=“padding-top:20px” id=“poss”>Possessive 數量值</th></tr>

<tr><th style=“vertical-align:top; font-weight:normal” id=“poss_once_or_not”>X?+</th<>td headers=“matches poss poss_once_or_not”>X, once or not at all</td></tr<>tr><th style=“vertical-align:top; font-weight:normal” id=“poss_zero_or_more”>X/th><td headers=“matches poss poss_zero_or_more”>X*+<, zero 或 more times</td></tr><><th style=“vertical-align:top;font-weight:normal“ id=”poss_one_or_more“>X++</th><td headers=”matches poss poss_one_or_more“>X, one or more times</td></tr tr><><th style=”vertical-align:top; font-weight:normal“ id=”poss_exactly“>Xn}+</th<>td headers=”matches poss poss_exactly“>X{, exactly n times</td></tr tr><><th style=“vertical-align:top;font-weight:normal“ id=”poss_at_least“>X{n,}+</th<>td headers=”matches poss poss_at_least“>X, 至少 n times</td></tr tr>><<th style=”vertical-align:top; font-weight:normal“ id=”poss_at_least_up_to“>X{ n, m}+</th<>td headers=”matches poss poss_at_least_up_to“>X, 至少 n但不超過 m 次</td></tr>

<tr><th colspan=“2” style=“padding-top:20px” id=“logical”>Logical operators</th></tr>

<tr><th style=“vertical-align:top; font-weight:normal” id=“concat”>XY</><th td headers=“matches logical concat”>X followed by Y</td></tr tr><><th style=“vertical-align:top; font-weight:normal” id=“alternate”>X|Y</th<>td headers=“matches logical alternate”>Either X or Y</td></tr><><th style=“vertical-align:top;font-weight:normal“ id=”group“>(X)</th><td headers=”符合邏輯群組“>X,作為擷取群組</td></tr>

<tr><th colspan=“2” style=“padding-top:20px” id=“backref”>Back references</th></tr>

<tr><th style=“vertical-align:top; font-weight:normal” id=“back_nth”>\n</th><td headers=“matches backref back_nth”>任何 n<sup th</sup>> 撷取群組 matched</td></tr tr<>><th style=“vertical-align:top; font-weight:normal” id=“back_named”>\k<;name></th><td headers=“會比對回ref back_named”>任何具名擷取群組 “name” 相符的專案。 僅適用於 API 26 或更新版本</td></tr>

<tr><th colspan=“2” style=“padding-top:20px” id=“quote”>Quote</th></tr>

<tr><th style=“vertical-align:top; font-weight:normal” id=“quote_follow”>\</th<>td headers=“matches quote quote_follow”>Nothing, but quotes the following character/td></tr><tr><th style=“vertical-align:top; font-weight:normal” id=“quote_begin”\Q<>/th<>td headers=“matches quote quote_begin”>Nothing, but quotes all characters< until \E</td></tr tr><><th style=“vertical-align:top;font-weight:normal“ id=”quote_end“>\E</th<>td headers=”符合引號quote_end“>Nothing,但結束引號開頭為 \Q</td></tr><-- Metachars: !$ () *+.?<>[\]^{|}-->

<tr><th colspan=“2” style=“padding-top:20px” id=“special”>Special constructs (named-capturing and non-capturing) </th></tr>

<tr><th style=“vertical-align:top; font-weight:normal” id=“named_group”>(?&lt;<a href="#groupname">name</a>&gt;X)</th><td headers=“符合特殊named_group”>X,作為具名擷取群組。 僅適用於 API 26 或更新版本。</td></tr><tr><th style=“vertical-align:top; font-weight:normal” id=“non_capture_group”>(?:X)</th><td headers=“符合特殊non_capture_group”>X,作為非擷取群組</td/tr><tr><th style=“vertical-align:top; font-weight:normal” id=“flags”><(?idmsux-idmsux)&nbsp;/th> sU on - off</td><></tr><tr><th style=“vertical-align:top; font-weight:normal” id=“non_capture_group_flags“>(?idmsuxU-idmsuxU:X)  </th><td headers=“符合特殊non_capture_group_flags”>X, 作為具有指定旗標 du</a > U on - off</td/tr tr><<>th style=“vertical-align:top; font-weight:normal” id=“pos_lookahead”><c> (?=</c><i>X/i><c><) /c></th<>td>< headers=“符合特殊pos_lookahead”><i>X<</i>,透過零寬度正面外觀</td></Tr><tr><th style=“vertical-align:top; font-weight:normal” id=“neg_lookahead”><c> (?!</c><i>X</i><c>) </c></th><td headers=“符合特殊neg_lookahead”><i>X</i>, 透過零寬度負外觀</td></tr><th><style=“vertical-align:top; font-weight:normal” id=“pos_lookbehind”><c> (?<=</c><i>x/i><c><) /c></th<>td headers=“matches special pos_lookbehind”><i>X<</i>, via零寬度正外觀behind</td></tr tr>><<th style=“vertical-align:top; font-weight:normal” id=“neg_lookbehind”><c> (?<!</c><i>X</i><c>) </c></th><td headers=“符合特殊neg_lookbehind”><i X</i>>,透過零寬度負向負外觀/<td></tr tr><><th style=“vertical-align:top; font-weight:normal” id=“indep_non_capture_group”><c> (?></c><i>X</i><c>) </c></th<>td headers=“符合特殊indep_non_capture_group”><i X</i>>,作為獨立、非擷取群組</td></tr>

</tbody></table>

<小時>

<h2>“bs”>反斜杠、逸出和引號</h2>

反斜杠字元 ('\') 用來導入逸出建構,如上表所定義,以及將不逸出建構解譯為未逸出建構的引號字元。 因此,表達式 \\ 會比對單一反斜杠,並 \{ 符合左大括弧。

在未表示逸出建構的任何字母字元之前,使用反斜杠是錯誤的;這些會保留給正則表達式語言的未來擴充功能。 不論該字元是否為未逸出建構的一部分,都可以在非字母字元之前使用反斜杠。

<引用 Java 語言規格</引用>>為 Unicode 逸出 (區段 {

已在1.4中新增。

java.util.regex.PatternJava 檔。

此頁面的部分是根據 所建立和共用的工作進行修改,並根據 2.5 屬性授權中所述的詞彙來使用。

欄位

CanonEq
已淘汰.

Android 不支援此旗標。

CaseInsensitive
已淘汰.

啟用不區分大小寫的比對。

Comments
已淘汰.

允許模式中的空格元和批注。

Dotall
已淘汰.

啟用 dotall 模式。

Literal
已淘汰.

啟用模式的常值剖析。

Multiline
已淘汰.

啟用多行模式。

UnicodeCase
已淘汰.

啟用 Unicode 感知大小寫折疊。

UnicodeCharacterClass
已淘汰.

Android 不支援此旗標,而且一律會使用 Unicode 字元類別。

UnixLines
已淘汰.

啟用 Unix 行模式。

屬性

Class

傳回這個 Object的運行時間類別。

(繼承來源 Object)
Handle

基礎Android實例的句柄。

(繼承來源 Object)
JniIdentityHashCode

正則表達式的編譯表示。

(繼承來源 Object)
JniPeerMembers

正則表達式的編譯表示。

PeerReference

正則表達式的編譯表示。

(繼承來源 Object)
ThresholdClass

此 API 支援 Mono for Android 基礎結構,並不適合直接從您的程式代碼使用。

(繼承來源 Object)
ThresholdType

此 API 支援 Mono for Android 基礎結構,並不適合直接從您的程式代碼使用。

(繼承來源 Object)

方法

AsMatchPredicate()

建立述詞,以測試此模式是否符合指定的輸入字串。

AsPredicate()

建立述詞,以測試此模式是否在指定的輸入字串中找到。

Clone()

建立並傳回這個 對象的複本。

(繼承來源 Object)
Compile(String)

將指定的正則表達式編譯成模式。

Compile(String, RegexOptions)

使用指定的旗標,將指定的正則表達式編譯成模式。

Dispose()

正則表達式的編譯表示。

(繼承來源 Object)
Dispose(Boolean)

正則表達式的編譯表示。

(繼承來源 Object)
Equals(Object)

指出其他物件是否「等於」這個物件。

(繼承來源 Object)
Flags()

傳回此模式的相符旗標。

GetHashCode()

傳回此物件的雜湊碼值。

(繼承來源 Object)
InvokePattern()

傳回編譯此模式的正則表達式。

JavaFinalize()

當垃圾收集判斷對象沒有其他參考時,由物件上的垃圾收集行程呼叫。

(繼承來源 Object)
Matcher(ICharSequence)

建立比對器,以符合此模式的指定輸入。

Matcher(String)

建立比對器,以符合此模式的指定輸入。

Matches(String, ICharSequence)

編譯指定的正則表示式,並嘗試比對指定的輸入。

Matches(String, String)

編譯指定的正則表示式,並嘗試比對指定的輸入。

Notify()

喚醒正在等候此物件的監視器的單一線程。

(繼承來源 Object)
NotifyAll()

喚醒正在等候此物件監視器的所有線程。

(繼承來源 Object)
Quote(String)

傳回指定 String之的常值模式String

SetHandle(IntPtr, JniHandleOwnership)

設定 Handle 屬性。

(繼承來源 Object)
Split(ICharSequence)

根據此模式的相符專案來分割指定的輸入序列。

Split(ICharSequence, Int32)

根據此模式的相符專案來分割指定的輸入序列。

Split(String)

根據此模式的相符專案來分割指定的輸入序列。

Split(String, Int32)

根據此模式的相符專案來分割指定的輸入序列。

ToArray<T>()

正則表達式的編譯表示。

(繼承來源 Object)
ToString()

傳回物件的字串表示。

(繼承來源 Object)
UnregisterFromRuntime()

正則表達式的編譯表示。

(繼承來源 Object)
Wait()

讓目前的線程等到喚醒為止,通常是藉由 <em>notified</em> 或 <em>interrupted</em> 來喚醒。

(繼承來源 Object)
Wait(Int64)

讓目前的線程等到喚醒為止,通常是<透過em>notified</em或em>interrupted</em>>,或<直到經過一定數量的實時為止。

(繼承來源 Object)
Wait(Int64, Int32)

讓目前的線程等到喚醒為止,通常是<透過em>notified</em或em>interrupted</em>>,或<直到經過一定數量的實時為止。

(繼承來源 Object)

明確介面實作

IJavaPeerable.Disposed()

正則表達式的編譯表示。

(繼承來源 Object)
IJavaPeerable.DisposeUnlessReferenced()

正則表達式的編譯表示。

(繼承來源 Object)
IJavaPeerable.Finalized()

正則表達式的編譯表示。

(繼承來源 Object)
IJavaPeerable.JniManagedPeerState

正則表達式的編譯表示。

(繼承來源 Object)
IJavaPeerable.SetJniIdentityHashCode(Int32)

正則表達式的編譯表示。

(繼承來源 Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates)

正則表達式的編譯表示。

(繼承來源 Object)
IJavaPeerable.SetPeerReference(JniObjectReference)

正則表達式的編譯表示。

(繼承來源 Object)

擴充方法

JavaCast<TResult>(IJavaObject)

執行 Android 執行時間檢查的類型轉換。

JavaCast<TResult>(IJavaObject)

正則表達式的編譯表示。

GetJniTypeName(IJavaPeerable)

正則表達式的編譯表示。

適用於