std::regex_constants::syntax_option_type — cppreference.com
De cppreference.com
<metanoindex/>
<tbody> </tbody>
| Déclaré dans l'en-tête <regex> |
||
|
|
||
Le syntax_option_type est un BitmaskType qui contient des options qui régissent la façon dont se comportent les expressions régulières .
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.
Les valeurs possibles pour ce type (icase, optimize, etc) sont doublées à l'intérieur std :: basic_regex .
Original:
The possible values for this type (icase, optimize, etc.) are duplicated inside std :: basic_regex.
The text has been machine-translated via Google Translate.
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. |
Effect(s) |
icase
|
Correspondance caractères doit être effectuée sans respecter la casse . Original: Character matching should be performed without regard to case. The text has been machine-translated via Google Translate. |
nosubs
|
Lors de l'exécution 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. |
optimize
|
Charge le moteur d'expressions régulières à faire correspondre plus rapidement, avec le coût potentiel de faire de la construction plus lente. Par exemple, cela pourrait signifier la conversion d'un FSA non-déterministe à une déterministe 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. |
collate
|
Les plages de caractères 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. |
ECMAScript
|
Utilisez le code ECMAScript (JavaScript) grammaire expression régulière (ECMA-262 grammar documentation), modifié pour supporter des éléments d'assemblage, les classes de personnages, et des classes d'équivalence de POSIX, et les alias de classes de caractères Original: 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 The text has been machine-translated via Google Translate. |
basic
|
Utilisez la grammaire de base des expressions régulières POSIX (grammar documentation) . Original: Use the basic POSIX regular expression grammar (grammar documentation). The text has been machine-translated via Google Translate. |
extended
|
Utilisez la grammaire prolongée expression rationnelle POSIX (grammar documentation) . Original: Use the extended POSIX regular expression grammar (grammar documentation). The text has been machine-translated via Google Translate. |
awk
|
Utilisez la grammaire expression régulière utilisée 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. |
grep
|
Utilisez la grammaire expression régulière utilisée par l'utilitaire grep' dans POSIX. C'est effectivement la même que l'option Original: Use the regular expression grammar used by the grep utility in POSIX. This is effectively the same as the The text has been machine-translated via Google Translate. |
egrep
|
Utilisez la grammaire expression régulière utilisée par l'utilitaire grep', avec l'option-E, dans POSIX. C'est effectivement la même que l'option Original: Use the regular expression grammar used by the grep utility, with the -E option, in POSIX. This is effectively the same as the The text has been machine-translated via Google Translate. |
Notes
Parce que POSIX utilise "le plus long le plus à gauche" règle de correspondance (la sous-séquence la plus longue correspondance est trouvée, et si il ya plusieurs séquences 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 première à la "<tag" "</tag>" dernière, y compris tous les "</tag>" et "<tag>" entre les deux. D'autre part, prend en charge ECMAScript non gourmandes matchs, et la spécification ECMAScript regex "<tag[^>]*>.*?</tag>" correspondrait seulement jusqu'à la première 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.
Exemple
Illustre la différence 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.
#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'; }
Résultat :
Searching for .*(a|xayy) in zzxayyzz: ECMA (depth first search) match: zzxa POSIX (leftmost longest) match: zzxayy
Voir aussi
objet expression régulière Original: regular expression object The text has been machine-translated via Google Translate. (classe générique) [edit] | |