std::regex_match
![]() |
Questa pagina è stata tradotta in modo automatico dalla versione in ineglese della wiki usando Google Translate.
La traduzione potrebbe contenere errori e termini strani. Muovi il puntatore sopra al testo per vedere la versione originale. Puoi aiutarci a correggere gli gli errori. Per ulteriori istruzioni clicca qui. |
Elemento definito nell'header <regex>
|
||
template< class BidirIt, class Alloc, class CharT, class Traits > |
(1) | (dal C++11) |
template< class BidirIt, class CharT, class Traits > |
(2) | (dal C++11) |
template< class CharT, class Alloc, class Traits > bool regex_match( const CharT* str, |
(3) | (dal C++11) |
template< class STraits, class SAlloc, class Alloc, class CharT, class Traits > |
(4) | (dal C++11) |
template< class CharT, class Traits > bool regex_match( const CharT* str, |
(5) | (dal C++11) |
template< class STraits, class SAlloc, class CharT, class Traits > |
(6) | (dal C++11) |
e
espressione regolare e l'intera sequenza di caratteri di destinazione [first,last)
, tenendo conto degli effetti di flags
. I risultati delle partite vengono restituiti in m
.e
and the entire target character sequence [first,last)
, taking into account the effect of flags
. Match results are returned in m
.You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
Indice |
[modifica] Parametri
first, last | - | l'intervallo di caratteri di destinazione per applicare la regex per, dato come iteratori
Original: the target character range to apply the regex to, given as iterators The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
m | - | i risultati delle partite
Original: the match results The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
str | - | stringa di destinazione, data come terminazione null di tipo C stringa
Original: the target string, given as a null-terminated C-style string The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
s | - | stringa di destinazione, dato come std::basic_string
Original: the target string, given as a std::basic_string The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
e | - | l'espressione regolare
Original: the regular expression The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
flags | - | flag usato per determinare come la partita verrà eseguita
Original: flags used to determine how the match will be performed The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Type requirements | ||
-BidirIt must meet the requirements of BidirectionalIterator .
|
[modifica] Valore di ritorno
m
, come segue:m
is updated, as follows:You can help to correct and verify the translation. Click here for instructions.
You can help to correct and verify the translation. Click here for instructions.
m.ready() == true | |
m.empty() == true | |
m.size() == 0 |
You can help to correct and verify the translation. Click here for instructions.
m.ready() | true |
m.empty() | false |
m.size() | numero di sottoespressioni più 1, cioè, 1+e.mark_count()
Original: number of subexpressions plus 1, that is, 1+e.mark_count() The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
m.prefix().first | first
|
m.prefix().second | first
|
m.prefix().matched | false (il prefisso partita è vuota)
Original: false (the match prefix is empty) The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
m.suffix().first | last
|
m.suffix().second | last
|
m.suffix().matched | false (il suffisso partita è vuota)
Original: false (the match suffix is empty) The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
m[0].first | first
|
m[0].second | last
|
m[0].matched | true (l'intera sequenza corrisponde)
Original: true (the entire sequence is matched) The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
m[n].first | l'inizio della sequenza che ha trovato sottoespressione n, o
last se la sottoespressione non ha partecipato alla partitaOriginal: the start of the sequence that matched sub-expression n, or last if the subexpression did not participate in the matchThe text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
m[n].second | la fine della sequenza che ha trovato sottoespressione n, o
last se la sottoespressione non ha partecipato alla partitaOriginal: the end of the sequence that matched sub-expression n, or last if the subexpression did not participate in the matchThe text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
m[n].matched | true se sottoespressione n partecipato alla partita, false altrimenti
Original: true if sub-expression n participated in the match, false otherwise The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
[modifica] Esempio
#include <iostream> #include <string> #include <regex> int main() { std::string fnames[] = {"foo.txt", "bar.txt", "zoidberg"}; std::regex txt_regex("[a-z]+\\.txt"); for (const auto &fname : fnames) { std::cout << fname << ": " << std::regex_match(fname, txt_regex) << '\n'; } }
Output:
foo.txt: 1 bar.txt: 1 zoidberg: 0
[modifica] Vedi anche
(C++11) |
Espressione oggetto regolare Original: regular expression object The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (classe template) |
(C++11) |
identifica una partita di espressione regolare, inclusi tutti i sub-espressione partite Original: identifies one regular expression match, including all sub-expression matches The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (classe template) |