Espacios de nombres
Variantes
Acciones

std::regex_constants::syntax_option_type

De cppreference.com
< cpp‎ | regex

 
 
Expresiones biblioteca Regular
Clases
Original:
Classes
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
basic_regex(C++11)
sub_match(C++11)
match_results(C++11)
Algoritmos
Original:
Algorithms
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
regex_match(C++11)
regex_search(C++11)
regex_replace(C++11)
Los iteradores
Original:
Iterators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
regex_iterator(C++11)
regex_token_iterator(C++11)
Excepciones
Original:
Exceptions
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
regex_error(C++11)
Rasgos
Original:
Traits
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
regex_traits(C++11)
Constantes
Original:
Constants
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
syntax_option_type(C++11)
match_flag_type(C++11)
error_type(C++11)
 
Defined in header <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*/;
El syntax_option_type es un BitmaskType que contiene opciones que controlan cómo se comportan las expresiones regulares .
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.
Los valores posibles de este tipo (icase, optimize, etc) se duplican dentro 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.

Contenido

[editar] Constantes

Valor
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 Character matching should be performed without regard to case.
nosubs When performing matches, no sub-expression matches should be stored in the supplied std::regex_match structure.
optimize 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.
collate Character ranges of the form "[a-b]" will be locale sensitive.
ECMAScript 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-sensitive
basic Use the basic POSIX regular expression grammar (grammar documentation).
extended Use the extended POSIX regular expression grammar (grammar documentation).
awk Use the regular expression grammar used by the awk utility in POSIX (grammar documentation)
grep 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.
egrep 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 '|'.

[editar] Notas

Debido POSIX utiliza "más larga más a la izquierda" regla que coincide (la subsecuencia más larga correspondencia es igual, y si hay varias subsecuencias tales, el primero está emparejado), que no es adecuado, por ejemplo, para analizar los lenguajes de marcado: una expresión regular POSIX tales como "<tag[^>]*>.*</tag>" coincidiría con todo, desde la primera hasta la "<tag" "</tag>" pasado, incluyendo todos los "</tag>" y inbetween "<tag>". Por otro lado, ECMAScript apoya la no codiciosos partidos, y el ECMAScript "<tag[^>]*>.*?</tag>" regex coincidirá sólo hasta que la primera etiqueta de cierre .
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.

[editar] Ejemplo

Ilustra la diferencia en el algoritmo de coincidencia entre ECMAScript y expresiones regulares 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';
}

Output:

Searching for .*(a|xayy) in zzxayyzz:
 ECMA (depth first search) match: zzxa
 POSIX (leftmost longest)  match: zzxayy

[editar] Ver también

objeto de expresión regular
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.

(clase de plantilla) [edit]