std::regex_search

来自cppreference.com

 
 
正則表達式庫
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)
演算法
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)
迭代器
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)
例外
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)
性狀
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)
常量
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>
template< class BidirIt,

          class Alloc, class CharT, class Traits >
bool regex_search( BidirIt first, BidirIt last,
                   std::match_results<BidirIt,Alloc>& m,
                   const std::basic_regex<CharT,Traits>& e,
                   std::regex_constants::match_flag_type flags =

                       std::regex_constants::match_default );
(1) (C++11 起)
template< class Alloc, class CharT, class Traits >

bool regex_search( const CharT* str,
                   std::match_results<BidirIt,Alloc>& m,
                   const std::basic_regex<CharT,Traits>& e,
                   std::regex_constants::match_flag_type flags =

                       std::regex_constants::match_default );
(2) (C++11 起)
template< class STraits, class SAlloc,

          class Alloc, class CharT, class Traits >
bool regex_search( const std::basic_string<CharT,STraits,SAlloc>& s,
                   std::match_results<
                       typename std::basic_string<CharT,STraits,SAlloc>::const_iterator,
                       Alloc
                   >& m,
                   const std::basic_regex<CharT, Traits>& e,
                   std::regex_constants::match_flag_type flags =

                       std::regex_constants::match_default );
(3) (C++11 起)
template< class BidirIt,

          class CharT, class Traits >
bool regex_search( BidirIt first, BidirIt last,
                   const std::basic_regex<CharT,Traits>& e,
                   std::regex_constants::match_flag_type flags =

                       std::regex_constants::match_default );
(4) (C++11 起)
template< class CharT, class Traits >

bool regex_search( const CharT* str,
                   const std::basic_regex<CharT,Traits>& e,
                   std::regex_constants::match_flag_type flags =

                       std::regex_constants::match_default );
(5) (C++11 起)
template< class STraits, class SAlloc,

          class CharT, class Traits >
bool regex_search( const std::basic_string<CharT,STraits,SAlloc>& s,
                   const std::basic_regex<CharT,Traits>& e,
                   std::regex_constants::match_flag_type flags =

                       std::regex_constants::match_default );
(6) (C++11 起)
1)
確定是否存在正規快件e和一些子序列中的目標字元序列[first,last)之間的匹配。比賽結果中返回m.
Original:
Determines if there is a match between the regular express e and some subsequence in the target character sequence [first,last). Match results are returned in m.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
2)
返回的std :: regex_search(STR,STR +的std ::的char_traits <charT> ::長度(STR),M,E,旗).
Original:
Returns std::regex_search(str, str + std::char_traits<charT>::length(str), m, e, flags).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
3)
返回的std :: regex_search(s.begin(),s.end(),M,E,旗).
Original:
Returns std::regex_search(s.begin(), s.end(), m, e, flags).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
4)
如(1)中,省略了匹配結果相同.
Original:
The same as (1), omitting 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.
5)
返回的std :: regex_search(str中,STR +的std :: char_traits <charT> ::長度(STR),E,標誌).
Original:
Returns std::regex_search(str, str + std::char_traits<charT>::length(str), e, flags).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
6)
返回的std :: regex_search(s.begin()中,s.end(),電子,旗).
Original:
Returns std::regex_search(s.begin(), s.end(), e, flags).
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[编辑] 參數

first, last -
的目標字元範圍
Original:
the target character range
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
m -
比賽結果
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 -
目標字元NULL結尾的C風格字元串
Original:
a target character 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 -
目標字元的std :: basic_string的
Original:
a target character 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 -
在std ::正則表達式
Original:
the std::regex
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
flags -
匹配標誌
Original:
the match flags
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.
-
Alloc must meet the requirements of Allocator.

[编辑] 返回值

返回true如果存在匹配目標序列中的某個地方,false否則.
Original:
Returns true if a match exists somewhere in the target sequence, false otherwise.
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.