basic_regex Class
Zawija wyrażenia regularnego.
template<class Elem,
class RXtraits = regex_traits<Elem>,
class basic_regex {
public:
basic_regex();
explicit basic_regex(const Elem *ptr,
flag_type flags = ECMAScript);
basic_regex(const Elem *ptr, size_type len,
flag_type flags = ECMAScript);
basic_regex(const basic_regex& right);
template<class STtraits, class STalloc>
explicit basic_regex(const basic_string<Elem, STtraits, STalloc>& str,
flag_type flags = ECMAScript);
template<class InIt>
explicit basic_regex(InIt first, InIt last,
flag_type flags = ECMAScript);
basic_regex& operator=(const basic_regex& right);
basic_regex& operator=(const Elem *ptr);
template<class STtraits, class STalloc>
basic_regex& operator=(const basic_string<Elem, STtraits, STalloc>& str);
basic_regex& assign(const basic_regex& right);
basic_regex& assign(const Elem *ptr,
flag_type flags = ECMAScript);
basic_regex& assign(const Elem *ptr, size_type len,
flag_type flags = ECMAScript);
template<class STtraits, class STalloc>
basic_regex& assign(const basic_string<Elem, STtraits, STalloc>& str,
flag_type flags = ECMAScript);
template<class InIt>
basic_regex& assign(InIt first, InIt last,
flag_type flags = ECMAScript);
locale_type imbue(locale_type loc);
locale_type getloc() const;
void swap(basic_regex& other) throw();
unsigned mark_count() const;
flag_type flags() const;
typedef Elem value_type;
typedef regex_constants::syntax_option_type flag_type;
typedef typename RXtraits::locale_type locale_type;
static const flag_type icase = regex_constants::icase;
static const flag_type nosubs = regex_constants::nosubs;
static const flag_type optimize = regex_constants::optimize;
static const flag_type collate = regex_constants::collate;
static const flag_type ECMAScript = regex_constants::ECMAScript;
static const flag_type basic = regex_constants::basic;
static const flag_type extended = regex_constants::extended;
static const flag_type awk = regex_constants::awk;
static const flag_type grep = regex_constants::grep;
static const flag_type egrep = regex_constants::egrep;
private:
RXtraits traits; // exposition only
};
Parametry
Elem
Typ elementów, aby dopasować.RXtraits
Cech klasy elementów.
Uwagi
Klasa szablonu opisuje obiekt przechowujący wyrażenia regularnego.Obiekty tej klasy szablonu mogą być przekazywane do funkcji szablonu regex_match Function, regex_search Function, i regex_replace Function, wraz z argumentami typu string odpowiedni tekst, aby wyszukać tekst, który odpowiada wyrażeniu regularnemu.Biblioteka TR1 zawiera dwa kierunki tej klasy szablonu z definicji typu regex Typedef dla elementów typu char, i wregex Typedef dla elementów typu wchar_t.
Argument szablonu RXtraits w tym artykule opisano różne ważne właściwości w składni wyrażeń regularnych, które obsługuje klasy szablonu.Klasa, która określa tych cech wyrażenia regularnego muszą mieć ten sam interfejs zewnętrzny jako obiekt szablonu klasy regex_traits Class.
Niektóre funkcje podjąć sekwencji operand, który definiuje wyrażenia regularnego.Można określić takie operand sekwencji na kilka sposobów:
ptr--sekwencji zakończony znakiem null (takie jak ciąg c dla Elem typu char) począwszy od ptr (który musi być wskaźnik zerowy), gdzie element zakończeń jest wartością value_type() i nie jest częścią sekwencji operandu
ptr, count --sekwencji count elementów, zaczynając od ptr (który musi być wskaźnik zerowy)
str--kolejności określonej przez basic_string obiektustr
first, last --sekwencja elementów rozdzielone Iteratory first i last, w zakresie[first, last)
right-- basic_regex obiekturight
Te funkcje składowe także podjąć argumentu flags , który określa różne opcje interpretacji wyrażenia regularnego w uzupełnieniu do tych opisanych przez RXtraits typu.
Wymagania
Nagłówek: <regex>
Obszar nazw: std
Zobacz też
Informacje
Inne zasoby
<regex> Członkowie