std::regex_match
![]() | このページは、Google 翻訳を使って英語版から機械翻訳されました。 翻訳には誤りや奇妙な言い回しがあるかもしれません。文章の上にポインタをおくと、元の文章が見れます。誤りを修正して翻訳を改善する手助けをしてください。翻訳についての説明は、ここをクリックしてください。 |
Defined in header <regex> | ||
template<class BidirIt, class Alloc, class CharT, class Traits > | (1) | (C++11およびそれ以降) |
template<class BidirIt, class CharT, class Traits > | (2) | (C++11およびそれ以降) |
template<class CharT, class Alloc, class Traits > bool regex_match(const CharT* str, | (3) | (C++11およびそれ以降) |
template<class STraits, class SAlloc, class Alloc, class CharT, class Traits > | (4) | (C++11およびそれ以降) |
template<class CharT, class Traits > bool regex_match(const CharT* str, | (5) | (C++11およびそれ以降) |
template<class STraits, class SAlloc, class CharT, class Traits > | (6) | (C++11およびそれ以降) |
e
、考慮[first,last)
の影響を受け、正規表現flags
と全体目標の文字配列との間の一致があるかどうかを判断します。試合結果はm
で返されます.e
and the entire target character sequence [first,last)
, taking into account the effect of flags
. Match results are returned in m
.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.
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.
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.
目次 |
[編集]パラメータ
first, last | - | イテレータとして与えられたに正規表現を適用する対象の文字範囲、 Original: the target character range to apply the regex to, given as iterators 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 | - | ヌルで終わるCスタイルの文字列として指定されたターゲット列 Original: the target string, given as a 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: the target string, given as a 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 | - | 正規表現 Original: the regular expression The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
flags | - | フラグが一致するものが実行される方法を決定するために使用 Original: flags used to determine how the match will be performed The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
型の要件 | ||
-BidirIt は BidirectionalIterator の要求を満足しなければなりません。 |
[編集]値を返します
m
は、次のように、更新されますm
is updated, as follows: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.
m.ready()==true | |
m.empty()==true | |
m.size()==0 |
You can help to correct and verify the translation. Click here for instructions.
m.ready() | true |
m.empty() | false |
m.size() | 部分式に1を足した数、1+e.mark_count()です Original: number of subexpressions plus 1, that is, 1+e.mark_count() The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
m.prefix().first | first |
m.prefix().second | first |
m.prefix().matched | false(マッチプレフィックスは空です) Original: false (the match prefix is empty) The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
m.suffix().first | last |
m.suffix().second | last |
m.suffix().matched | false(マッチサフィックスは空です) Original: false (the match suffix is empty) The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
m[0].first | first |
m[0].second | last |
m[0].matched | true(シーケンス全体がマッチする) Original: true (the entire sequence is matched) The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
m[n].first | 部分式がマッチしなかった場合、部分式n、または last にマッチしたシーケンスの開始Original: the start of the sequence that matched sub-expression n, or last if the subexpression did not participate in the matchThe text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
m[n].second | 部分式がマッチしなかった場合、部分式n、または last にマッチしたシーケンスの終端Original: the end of the sequence that matched sub-expression n, or last if the subexpression did not participate in the matchThe text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. |
m[n].matched | true場合部分式nfalseそうでなければ、試合に参加しました Original: true if sub-expression n participated in the match, false otherwise 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 fnames[]={"foo.txt", "bar.txt", "zoidberg"}; std::regex txt_regex("[a-z]+\\.txt");for(constauto&fname : fnames){std::cout<< fname <<": "<< std::regex_match(fname, txt_regex)<<'\n';}}
出力:
foo.txt: 1 bar.txt: 1 zoidberg: 0
[編集]参照
(C++11) | 正規表現オブジェクト 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. (クラステンプレート) |
(C++11) | すべてのサブ表現の一致を含む一つの正規表現が一致した場合には、識別されます Original: identifies one regular expression match, including all sub-expression matches The text has been machine-translated via Google Translate. You can help to correct and verify the translation. Click here for instructions. (クラステンプレート) |