Pattern Classe
Definizione
Importante
Alcune informazioni sono relative alla release non definitiva del prodotto, che potrebbe subire modifiche significative prima della release definitiva. Microsoft non riconosce alcuna garanzia, espressa o implicita, in merito alle informazioni qui fornite.
Rappresentazione compilata di un'espressione regolare.
[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
- Ereditarietà
- Attributi
- Implementazioni
Commenti
Rappresentazione compilata di un'espressione regolare.
Un'espressione regolare, specificata come stringa, deve prima essere compilata in un'istanza di questa classe. Il modello risultante può quindi essere usato per creare un Matcher
oggetto che possa corrispondere a sequenze di caratteri java.lang.CharSequence arbitrarie rispetto all'espressione regolare. Tutto lo stato coinvolto nell'esecuzione di una corrispondenza risiede nel matcher, quindi molti matcher possono condividere lo stesso modello.
Una tipica sequenza di chiamate è quindi
<Blockquote>
Pattern p = Pattern.{@link #compile compile}("a*b");
Matcher m = p.{@link #matcher matcher}("aaaaab");
boolean b = m.{@link Matcher#matches matches}();
</Blockquote>
Un #matches matches
metodo viene definito da questa classe come comodità per quando viene usata un'espressione regolare una sola volta. Questo metodo compila un'espressione e corrisponde a una sequenza di input in una singola chiamata. L'istruzione
<Blockquote>
boolean b = Pattern.matches("a*b", "aaaaab");
</Blockquote>
equivale alle tre istruzioni precedenti, anche se per le corrispondenze ripetute è meno efficiente perché non consente il riutilizzo del modello compilato.
Le istanze di questa classe non sono modificabili e sono sicure per l'uso da parte di più thread simultanei. Le istanze della Matcher
classe non sono sicure per tale utilizzo.
<h2>"sum">Riepilogo dei costrutti< di espressioni regolari/h2>
<table class="borderless">didascalia style="display:none">Regular expression constructs and what they match</didascalia>< thead style="text-align:left"><tr><th id="construct">Construct</th th<>id="matches">Matches</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 tr<>><th style="vertical-align:top; font-weight: normal" id="backslash">\\
</th><td headers="match characters backslash">The backslash character</td></tr tr<>><th style="vertical-align:top; font-weight: normal" id="octal_n">\0
n</th><td headers="corrisponde ai caratteri octal_n">Il carattere con valore 0
ottale n (0 <=
n <=
7)</td></tr tr><><th style="vertical-align:top; font-weight: normal" id="octal_nn"\0
>nn</th<>td headers="corrisponde ai caratteri octal_nn">Il carattere con valore 0
ottale nn (0 <=
n <=
7)</td></tr tr><><th style="vertical-align:top; font-weight: normal" id="octal_nnn">\0
mnn</th<>td headers="corrisponde ai caratteri octal_nnn">Il carattere con valore 0
ottale mnn (0 <=
m <=
3, 0 <=
n <=
7)</td></tr tr><><th style="vertical-align:top; font-weight: normal" id="hex_hh"\x
>hh</th<>td headers="matches characters hex_hh">The character with esadecimale value 0x
hh</td></tr tr<>><th style="vertical-align:top; font-weight: normal" id="hex_hhhh">\u
hhhh</th><td headers="matches characters hex_hhhh">Carattere con  esadecimale; valore 0x
Hhhh</td></tr tr><><th style="vertical-align:top; font-weight: normal" id="hex_h_h">\x
{h... h}</th><td headers="corrisponde ai caratteri hex_h_h">Il carattere con valore 0x
esadecimale h... h (java.lang.Character#MIN_CODE_POINT Character.MIN_CODE_POINT
<= 0x
H... h <= java.lang.Character#MAX_CODE_POINT Character.MAX_CODE_POINT
)</td></tr tr><><th style="vertical-align:top; font-weight: normal" id="unicode_name"\N{
>name}
</th><td headers="match characters unicode_name">The character with Unicode character name 'name'</td></tr>><<th style="vertical-align:top; font-weight:normal" id="tab"<\t
>/th><td headers="matches characters tab">The tab character ('\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 ('\u000A'
)</td></tr tr>><<th style="vertical-align:top; font-weight:normal" id="return"\r
<>/th><td headers="matches characters return">>The carriage-return character ( '\u000D'
)</td></tr tr><><th style="vertical-align:top; font-weight:normal" id="form_feed"\f
<>/th<>td headers="match characters form_feed"The form-feed character ()/td></tr tr<><>th style="vertical-align:top; font-weight:normal" id="bell"<\a
>/th><td headers="matches characters bell">>The alert (bell) character ('\u000C'
'\u0007'
)<</td></tr><tr><th style="vertical-align:top; font-weight:normal" id="escape"<>\e
/th<>td headers="match characters escape">The escape character ('\u001B'
)</td></tr tr><><th style="vertical-align:top; font-weight:normal" id="ctrl_x">\c
x</th<>td headers="match characters ctrl_x">The control character corrispondente a x</td></tr>
<tr><th colspan="2" style="padding-top:20px" id="classes">Character classes</th></tr>
<tr><th style="vertical-align:top; font-weight:normal" id="simple">[abc]
</th><td headers="matches classes simple", b
, or c
(simple class)</td></tr<>tr><th style="vertical-align:top; font-weight:normal" id="negation">[^abc]
</th><td headers="matches classes negation">a
>Any character except a
, b
or c
(negation)</td></tr tr><><th style="vertical-align:top; font-weight:normal" id="range">[a-zA-Z]
</th><td headers="matches classes range"a
> through or A
through Z
z
, inclusive (range)</td></tr tr>><<th style="vertical-align:top; font-weight:normal" id="union"<[a-d[m-p]]
>/th<>td headers="matches classes union"a
> through , or m
through d
p
: [a-dm-p]
(union)</td></tr tr><><th style="vertical-align:top; font-weight:normal" id="intersezione">[a-z&&[def]]
</th<>td headers="corrisponde all'intersezione delle classi"d
>, e
o f
(intersezione)</tr tr>><<th style="vertical-align:top; font-weight:normal" id="subtraction1"[a-z&&[^bc]]
<>/th><td headers="match classes subtraction1"a
> tramite z
, ad eccezione b
di e c
: [ad-z]
(sottrazione)</td></tr tr><><th style="vertical-align:top; font-weight:normal" id="subtraction2">[a-z&&[^m-p]]
</th<>td headers="matches classes subtraction2">a
through z
, and not m
through p
: [a-lq-z]
(sotttraction)</td></tr>
<tr><th colspan="2" style="padding-top:20px" id="predef">Defaulted character classes</th></tr>
<tr><th style="vertical-align:top; font-weight:normal" id="any"<>.
/th<>td headers="matches predef any">Any character (may or may not match line terminator)</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="matches 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\u1680\u180e\u2000-\u200a\u202f\u205f\u3000]
</td></tr tr><<>th style="vertical-align:top; font-weight:normal" id="non_horiz_white"\H
<>/th><td headers=" corrisponde al predef non_horiz_white">A non-horizontal whitespace character: [^\h]
</td></tr tr>><<th style="vertical-align:top; font-weight:normal" id="white"<\s
>/th><td headers="matches predef white">A white 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> carattere non spazi vuoti: [^\s]
/td></tr tr>><<th style="vertical-align:top; font-weight:normal" id="vert_white"\v
<>/th><td headers="matches predef vert_white">A vertical whitespace character:<[\n\x0B\f\r\x85\u2028\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">A non-vertical whitespace< character: [^\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 character classes (Unicode-aware)</b></th></tr>
<tr><th style="vertical-align:top; font-weight:normal" id="Lower"\p{Lower
>}</th><td headers="matches posix Lower">A lower-case alfabetic character: \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 alfabetic character:\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
>Cifra decimale: \p{gc=Decimal_Number
}</td></tr 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 print character: [\p{Graph
\p{Blank}&&[^\p{Cntrl}]}</td></tr tr>><<<\p{Graph
th 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="matches posix XDigit">A esadecimale digit: [\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{XDigit
POSIX-Compatible expression</th><td headers="matches posix PosixCompatible">See Unicode documentation</td></tr>
<tr><th colspan="2" style="padding-top:20px" id="java">java.lang.Character classes (simple java character type)</th></tr>
<tr><th style="vertical-align:top; font-weight:normal" id="javaLowerCase"\p{javaLowerCase
>}</th<>td headers="matches java javaLowerCase">Equivalent to java.lang.Character.isLowerCase()</td></tr tr><<>th style="vertical-align:top; font-weight:normal" id="javaUpperCase"\p{javaUpperCase
>}</th><td headers="matches javaupperCase">Equivalent to java.lang.Character.isUpperCase()</td></tr tr><><th style="vertical-align:top; font-weight:normal" id="javaWhitespace">}/th><td headers="match java javaWhitespace">Equivalent to java.lang.Character.isWhitespace()</td></tr><tr><th style="vertical-align:top; font-weight:normal" id="javaMirrored">\p{javaMirrored
}</th<>td headers="matches javaMirrored">Equivalent to java.lang.Character.isMirrored()</td></tr<\p{javaWhitespace
>
<tr><th colspan="2" style="padding-top:20px" id="unicode">Classis for Unicode scripts, blocks, categories and binary properties</th></tr>
<tr><th style="vertical-align:top; font-weight:normal" id="IsLatin">\p{IsLatin
}</th><td headers="matches unicode IsLatin">A Latin carattere script (script)</td></tr tr><><th style="vertical-align:top; font-weight:normal" id="InGreek"\p{InGreek
>}</th><td headers="matches unicode InGreek">A character in the Greek block (block)</td></tr 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 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">}/th><td headers="matches unicode Sc">A currency symbol</td></tr tr>><<th style="vertical-align:top; font-weight:normal" id="not_InGreek"\P{InGreek
>}</th><td headers="matches unicode not_InGreek">Any character except one in the Greek block (negation)</td></tr tr><><th style="vertical-align:top; font-weight:normal" id="not_uppercase"[\p{L
><\p{Sc
&&[^\p{Lu}]]}</th<>td headers="corrisponde a unicode not_uppercase">Qualsiasi lettera tranne una lettera maiuscola (sottrazione)</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">The beginning of a line</td></tr><tr><th style="vertical-align:top; font-weight:normal" id="end_line">$
</th><td headers="matches bounds end_line">The end of a line</td></tr tr<>><th style="vertical-align:top; font-weight:normal" id="word_boundary">\b
</th><td headers="matches bounds word_boundary">A word boundary</td></tr tr>><<th style="vertical-align:top; font-weight:normal" id="non_word_boundary"><\B
/th><td headers="matches bounds 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 bounds begin_input"L'inizio dell'input/td></tr tr<><>th style="vertical-align:top; font-weight:normal" id="end_prev_match"<>\G
/th<>td headers="matches bounds end_prev_match">The end of the previous match</td></tr tr>><<th style="vertical-align:top; font-weight:normal" id="end_input_except_term"\Z
></th><td headers="matches bounds end_input_except_term"><>Fine dell'input ma per il terminatore finale, se any</td></tr tr><<>th style="vertical-align:top; font-weight:normal" id="end_input">\z
</th<>td headers="matches bounds end_input">The end of the 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 equivalent to \u000D\u000A|[\u000A\u000B\u000C\u000D\u0085\u2028\u2029]
</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="greedy">Greedy quantifiers</th></tr>
<tr><th style="vertical-align:top; font-weight:normal" id="greedy_once_or_not">X?
</th<>td headers="matches greedy 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="match greedy greedy_zero_or_more">X, zero o più volte</td></tr><tr><th style="vertical-align:top; font-weight:normal" id="greedy_one_or_more">X+
</th><td headers="matches greedy greedy_one_or_more"X, one or more times</td></tr tr><<>th style="vertical-align:top; font-weight:normal" id="greedy_exactly">X{
n}
</th><td headers=">matches greedy greedy_exactly">X, exactly n times</td></tr tr><><th style="vertical-align:top; font-weight:normal" id="greedy_at_least">X{
n,
}</th<>td headers="matches greedy greedy_at_least">X, at least 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="corrisponde a greedy greedy_at_least_up_to">X, almeno n ma non più di m times</td></tr>
<tr><th colspan="2" style="padding-top:20px" id="reluc">I quantifiers< riluttanti/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 or more times</td></tr 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 or more times</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 tr><><th style="vertical-align:top; font-weight:normal" id="reluc_at_least">X{
n,}?
</th<>td headers="matches reluc reluc_at_least"X, at least n times</td></tr tr><><th style="vertical-align:top; font-weight:normal" id="reluc_at_least_up_to">X{
nm}?
<,
/th><td headers=">matches reluc reluc_at_least_up_to">X, almeno n n ma non più di m times</td></tr>
<tr><th colspan="2" style="padding-top:20px" id="poss">Possessive quantifiers</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 o più volte</td></tr 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">X{
n}+
</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, at least n times</td></tr tr<>><th style="vertical-align:top; font-weight:normal" id="poss_at_least_up_to">X{
nn,
m<}+
/th<>td headers="matches poss poss_at_least_up_to">X, almeno n n ma non più di m times</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 seguito da Y/td></tr tr<><>th style="vertical-align:top; font-weight:normal" id="alternate">X|
Y</th><td headers="match logical alternate">>O Y<</td></tr tr><><th style="vertical-align:top; font-weight:normal" id="group">(
X)
</th><td headers="matches logical group">X, as a capturing group</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">Whatever the n<sup>th</sup> capturing group matched</td></tr tr<>><th style="vertical-align:top; font-weight:normal" id="back_named">\
k<nome></th><td headers="matches backref back_named">Qualsiasi sia il nome del gruppo di acquisizione denominato "name". Disponibile solo per l'API 26 o versione successiva</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="match quote quote_follow">Nothing, ma virgolette il carattere</td></tr tr<>><seguente th style="vertical-align:top; font-weight:normal" id="quote_begin">\Q
</th<>td headers="match virgolette quote_begin">Nothing, ma virgolette tutti i caratteri fino \E
<a /td></tr tr><><th style="vertical-align:top; font-weight:normal" id="quote_end"><\E
/th<>td headers="matches quote quote_end">Nothing, but ends quoting started by \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"(?<<a href="#groupname">name</a>>
>X)
</th><td headers="corrisponde a speciali named_group">X, come gruppo di acquisizione denominato. Disponibile solo per l'API 26 o versione successiva.</td></tr tr><><th style="vertical-align:top; font-weight:normal" id="non_capture_group"(?:
>X)
</th><td headers="matches special non_capture_group">X, as a non-capturing group</td></tr tr><><th style="vertical-align:top; font-weight:normal" id="flags"><(?idmsux-idmsux)
/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="matches special non_capture_group_flags">X, come gruppo di non acquisizione con i flag specificati 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/c></th<>td headers="matches special pos_lookahead"><i X</i>>, via zero-width positive lookahead</td/>< tr><><th style="vertical-align:top; font-weight:normal" id="neg_lookahead"><c>(?!</c><i>X</i><c>)</c></th<>td headers="corrisponde a neg_lookahead speciali"><i>X</i>, via zero-width negative lookahead</td></tr tr<><>th style="vertical-align:top; font-weight:normal" id="pos_lookbehind"><c>(?<=</c><i>X</i><c>)</c></th<>td headers="corrisponde a speciali pos_lookbehind"><i>X</i>, tramite zero-width positive lookbehind</td></tr tr><><th style="vertical-align:top; font-weight:normal" id="neg_lookbehind"><c>(?<!</c><i>X/i><c>)</c></th><td headers="corrisponde a speciali neg_lookbehind"><i>X<</i>, tramite lookbehind</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="corrisponde a speciali indep_non_capture_group"><i>X</i>, come gruppo< indipendente e non di acquisizione/td></tr>
</tbody></table>
<h>
<h2>"bs"> Barre rovesciata, escape e virgolette</h2>
Il carattere barra rovesciata ('\'
) consente di introdurre costrutti di escape, come definito nella tabella precedente, nonché di virgolette che altrimenti verrebbero interpretati come costrutti senza caratteri di escape. L'espressione \\
corrisponde quindi a una singola barra rovesciata e \{
corrisponde a una parentesi graffa sinistra.
Si tratta di un errore di utilizzare una barra rovesciata prima di qualsiasi carattere alfabetico che non indica un costrutto preceduto da escape; sono riservati per le estensioni future al linguaggio delle espressioni regolari. Una barra rovesciata può essere utilizzata prima di un carattere non alfabetico indipendentemente dal fatto che tale carattere faccia parte di un costrutto senza caratteri di escape.
Le barre rovesciata all'interno di valori letterali stringa nel codice sorgente Java vengono interpretate come richiesto da <cite>The Java Language Specification</cite> as either Unicode escapes (section {
Aggiunta nella versione 1.4.
Documentazione java per java.util.regex.Pattern
.
Le parti di questa pagina sono modifiche basate sul lavoro creato e condiviso dal Android e usato in base ai termini descritti in 2.5 Attribution License Creative Commons 2.5 Attribution License.
Campi
CanonEq |
Obsoleti.
Questo flag non è supportato in Android. |
CaseInsensitive |
Obsoleti.
Abilita la corrispondenza senza distinzione tra maiuscole e minuscole. |
Comments |
Obsoleti.
Consente spazi vuoti e commenti nel modello. |
Dotall |
Obsoleti.
Abilita la modalità dotall. |
Literal |
Obsoleti.
Abilita l'analisi letterale del criterio. |
Multiline |
Obsoleti.
Abilita la modalità multilinea. |
UnicodeCase |
Obsoleti.
Abilita la riduzione del case compatibile con Unicode. |
UnicodeCharacterClass |
Obsoleti.
Questo flag non è supportato in Android e le classi di caratteri Unicode vengono sempre usate. |
UnixLines |
Obsoleti.
Abilita la modalità righe Unix. |
Proprietà
Class |
Restituisce la classe di runtime di questo |
Handle |
Handle per l'istanza di Android sottostante. (Ereditato da Object) |
JniIdentityHashCode |
Rappresentazione compilata di un'espressione regolare. (Ereditato da Object) |
JniPeerMembers |
Rappresentazione compilata di un'espressione regolare. |
PeerReference |
Rappresentazione compilata di un'espressione regolare. (Ereditato da Object) |
ThresholdClass |
Questa API supporta l'infrastruttura Mono per Android e non deve essere usata direttamente dal codice. (Ereditato da Object) |
ThresholdType |
Questa API supporta l'infrastruttura Mono per Android e non deve essere usata direttamente dal codice. (Ereditato da Object) |
Metodi
AsMatchPredicate() |
Crea un predicato che verifica se questo modello corrisponde a una determinata stringa di input. |
AsPredicate() |
Crea un predicato che verifica se questo modello viene trovato in una determinata stringa di input. |
Clone() |
Crea e restituisce una copia di questo oggetto. (Ereditato da Object) |
Compile(String) |
Compila l'espressione regolare specificata in un criterio. |
Compile(String, RegexOptions) |
Compila l'espressione regolare specificata in un criterio con i flag specificati. |
Dispose() |
Rappresentazione compilata di un'espressione regolare. (Ereditato da Object) |
Dispose(Boolean) |
Rappresentazione compilata di un'espressione regolare. (Ereditato da Object) |
Equals(Object) |
Indica se un altro oggetto è "uguale a" questo. (Ereditato da Object) |
Flags() |
Restituisce i flag di corrispondenza di questo modello. |
GetHashCode() |
Restituisce un valore del codice hash per l'oggetto. (Ereditato da Object) |
InvokePattern() |
Restituisce l'espressione regolare da cui è stato compilato questo modello. |
JavaFinalize() |
Chiamato dal Garbage Collector su un oggetto quando Garbage Collection determina che non sono presenti altri riferimenti all'oggetto . (Ereditato da Object) |
Matcher(ICharSequence) |
Crea un matcher che corrisponderà all'input specificato rispetto a questo modello. |
Matcher(String) |
Crea un matcher che corrisponderà all'input specificato rispetto a questo modello. |
Matches(String, ICharSequence) |
Compila l'espressione regolare specificata e tenta di trovare la corrispondenza con l'input specificato. |
Matches(String, String) |
Compila l'espressione regolare specificata e tenta di trovare la corrispondenza con l'input specificato. |
Notify() |
Riattiva un singolo thread in attesa del monitor dell'oggetto. (Ereditato da Object) |
NotifyAll() |
Riattiva tutti i thread in attesa del monitoraggio di questo oggetto. (Ereditato da Object) |
Quote(String) |
Restituisce un modello |
SetHandle(IntPtr, JniHandleOwnership) |
Imposta la proprietà Handle. (Ereditato da Object) |
Split(ICharSequence) |
Suddivide la sequenza di input specificata intorno alle corrispondenze di questo modello. |
Split(ICharSequence, Int32) |
Suddivide la sequenza di input specificata intorno alle corrispondenze di questo modello. |
Split(String) |
Suddivide la sequenza di input specificata intorno alle corrispondenze di questo modello. |
Split(String, Int32) |
Suddivide la sequenza di input specificata intorno alle corrispondenze di questo modello. |
ToArray<T>() |
Rappresentazione compilata di un'espressione regolare. (Ereditato da Object) |
ToString() |
Restituisce una rappresentazione in formato stringa dell'oggetto. (Ereditato da Object) |
UnregisterFromRuntime() |
Rappresentazione compilata di un'espressione regolare. (Ereditato da Object) |
Wait() |
Fa sì che il thread corrente attenda finché non viene risvegliato, in genere eseguendo <una>notifica</em> o <em>interrotto</em>. (Ereditato da Object) |
Wait(Int64) |
Fa sì che il thread corrente attenda finché non viene risvegliato, in genere eseguendo <una notifica</>em> o <em>interrotto</em> o fino a quando non è trascorsa una certa quantità di tempo reale. (Ereditato da Object) |
Wait(Int64, Int32) |
Fa sì che il thread corrente attenda finché non viene risvegliato, in genere eseguendo <una notifica</>em> o <em>interrotto</em> o fino a quando non è trascorsa una certa quantità di tempo reale. (Ereditato da Object) |
Implementazioni dell'interfaccia esplicita
IJavaPeerable.Disposed() |
Rappresentazione compilata di un'espressione regolare. (Ereditato da Object) |
IJavaPeerable.DisposeUnlessReferenced() |
Rappresentazione compilata di un'espressione regolare. (Ereditato da Object) |
IJavaPeerable.Finalized() |
Rappresentazione compilata di un'espressione regolare. (Ereditato da Object) |
IJavaPeerable.JniManagedPeerState |
Rappresentazione compilata di un'espressione regolare. (Ereditato da Object) |
IJavaPeerable.SetJniIdentityHashCode(Int32) |
Rappresentazione compilata di un'espressione regolare. (Ereditato da Object) |
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) |
Rappresentazione compilata di un'espressione regolare. (Ereditato da Object) |
IJavaPeerable.SetPeerReference(JniObjectReference) |
Rappresentazione compilata di un'espressione regolare. (Ereditato da Object) |
Metodi di estensione
JavaCast<TResult>(IJavaObject) |
Esegue una conversione del tipo verificato dal runtime Android. |
JavaCast<TResult>(IJavaObject) |
Rappresentazione compilata di un'espressione regolare. |
GetJniTypeName(IJavaPeerable) |
Rappresentazione compilata di un'espressione regolare. |