std::regex_constants::syntax_option_type
De cppreference.com
[] |
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
<metanoindex/>
<tbody> </tbody>| Dclar dans l'en-tte <regex>
|
||
typedef /*unspecified*/ syntax_option_type; static constexpr syntax_option_type icase = /*unspecified*/; static constexpr syntax_option_type nosubs = /*unspecified*/; static constexpr syntax_option_type optimize = /*unspecified*/; static constexpr syntax_option_type collate = /*unspecified*/; static constexpr syntax_option_type ECMAScript = /*unspecified*/; static constexpr syntax_option_type basic = /*unspecified*/; static constexpr syntax_option_type extended = /*unspecified*/; static constexpr syntax_option_type awk = /*unspecified*/; static constexpr syntax_option_type grep = /*unspecified*/; static constexpr syntax_option_type egrep = /*unspecified*/; |
||
Le
syntax_option_type est un BitmaskType qui contient des options qui rgissent la faon dont se comportent les expressions rgulires .Original:
The
syntax_option_type is a BitmaskType that contains options that govern how regular expressions behave.The text has been machine-translated via Google Translate.
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.
Les valeurs possibles pour ce type (
icase, optimize, etc) sont doubles l'intrieur std :: basic_regex .Original:
The text has been machine-translated via Google Translate.
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.
Constantes
Valeur
Original: Value The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Effect(s) |
icase
|
Correspondance caractres doit tre effectue sans respecter la casse .
Original: Character matching should be performed without regard to case. The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
nosubs
|
Lors de l'excution matchs, pas de matchs sous-expression doit tre stock dans la structure std::regex_match fourni .
Original: When performing matches, no sub-expression matches should be stored in the supplied std::regex_match structure. The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
optimize
|
Charge le moteur d'expressions rgulires faire correspondre plus rapidement, avec le cot potentiel de faire de la construction plus lente. Par exemple, cela pourrait signifier la conversion d'un FSA non-dterministe une dterministe FSA .
Original: Instructs the regular expression engine to make matching faster, with the potential cost of making construction slower. For example, this might mean converting a non-deterministic FSA to a deterministic FSA. The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
collate
|
Les plages de caractres de la forme "[ab]" sera sensible locale .
Original: Character ranges of the form "[a-b]" will be locale sensitive. The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
ECMAScript
|
Utilisez le code ECMAScript (JavaScript) grammaire expression rgulire (ECMA-262 grammar documentation), modifi pour supporter des lments d'assemblage, les classes de personnages, et des classes d'quivalence de POSIX, et les alias de classes de caractres
\d, \D, \s, \S, \w et \W sont fabriqus locale-sensiblesOriginal: Use the ECMAScript (JavaScript) regular expression grammar (ECMA-262 grammar documentation), modified to support collating elements, character classes, and equivalence classes from POSIX, and the character class aliases \d, \D, \s, \S, \w, and \W are made locale-sensitiveThe text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
basic
|
Utilisez la grammaire de base des expressions rgulires POSIX (grammar documentation) .
Original: Use the basic POSIX regular expression grammar (grammar documentation). The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
extended
|
Utilisez la grammaire prolonge expression rationnelle POSIX (grammar documentation) .
Original: Use the extended POSIX regular expression grammar (grammar documentation). The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
awk
|
Utilisez la grammaire expression rgulire utilise par l'utilitaire awk' dans POSIX (grammar documentation)
Original: Use the regular expression grammar used by the awk utility in POSIX (grammar documentation) The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
grep
|
Utilisez la grammaire expression rgulire utilise par l'utilitaire grep' dans POSIX. C'est effectivement la mme que l'option
basic avec l'ajout du saut de ligne '\ n' comme un sparateur d'alternance . Original: Use the regular expression grammar used by the grep utility in POSIX. This is effectively the same as the basic option with the addition of newline '\n' as an alternation separator. The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
egrep
|
Utilisez la grammaire expression rgulire utilise par l'utilitaire grep', avec l'option-E, dans POSIX. C'est effectivement la mme que l'option
extended avec l'ajout du saut de ligne '\ n' comme un sparateur d'alternance dans addtion | '. Original: Use the regular expression grammar used by the grep utility, with the -E option, in POSIX. This is effectively the same as the extended option with the addition of newline '\n' as an alternation separator in addtion to '|'. The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
Notes
Parce que POSIX utilise "le plus long le plus gauche" rgle de correspondance (la sous-squence la plus longue correspondance est trouve, et si il ya plusieurs squences telles, le premier est appari), il n'est pas appropri, par exemple, pour analyser les langages de balisage: une regex POSIX comme
"<tag[^>]*>.*</tag>" correspondrait tout, de la premire la "<tag" "</tag>" dernire, y compris tous les "</tag>" et "<tag>" entre les deux. D'autre part, prend en charge ECMAScript non gourmandes matchs, et la spcification ECMAScript regex "<tag[^>]*>.*?</tag>" correspondrait seulement jusqu' la premire balise fermante .Original:
Because POSIX uses "leftmost longest" matching rule (the longest matching subsequence is matched, and if there are several such subsequences, the first one is matched), it is not suitable, for example, for parsing markup languages: a POSIX regex such as
"<tag[^>]*>.*</tag>" would match everything from the first "<tag" to the last "</tag>", including every "</tag>" and "<tag>" inbetween. On the other hand, ECMAScript supports non-greedy matches, and the ECMAScript regex "<tag[^>]*>.*?</tag>" would match only until the first closing tag.The text has been machine-translated via Google Translate.
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.
Exemple
Illustre la diffrence de l'algorithme d'appariement entre ECMAScript et les expressions rationnelles POSIX
Original:
Illustrates the difference in the matching algorithm between ECMAScript and POSIX regular expressions
The text has been machine-translated via Google Translate.
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.
#include <iostream>
#include <string>
#include <regex>
int main()
{
std::string str = "zzxayyzz";
std::regex re1(".*(a|xayy)"); // ECMA
std::regex re2(".*(a|xayy)", std::regex::extended); // POSIX
std::cout << "Searching for .*(a|xayy) in zzxayyzz:\n";
std::smatch m;
std::regex_search(str, m, re1);
std::cout << " ECMA (depth first search) match: " << m[0] << '\n';
std::regex_search(str, m, re2);
std::cout << " POSIX (leftmost longest) match: " << m[0] << '\n';
}
Rsultat :
Searching for .*(a|xayy) in zzxayyzz:
ECMA (depth first search) match: zzxa
POSIX (leftmost longest) match: zzxayy
Voir aussi
(C++11) |
objet expression rgulire 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 gnrique) |