1 개요
- C++ regex_search()
C++
CPU
2.6s
MEM
171M
2.6s
Copy
#include <iostream>
#include <string>
#include <regex>
using namespace std;
int main ()
{
string s ("this subject has a submarine as a subsequence");
smatch m;
regex e ("\\b(sub)([^ ]*)"); // matches words beginning by "sub"
cout << "Target sequence: " << s << endl;
cout << "Regular expression: /\\b(sub)([^ ]*)/" << endl;
cout << "The following matches and submatches were found:" << endl;
while (regex_search (s,m,e)) {
for (auto x:m) std::cout << x << " ";
cout << endl;
s = m.suffix().str();
}
}
Target sequence: this subject has a submarine as a subsequence Regular expression: /\b(sub)([^ ]*)/ The following matches and submatches were found: subject sub ject submarine sub marine subsequence sub sequence
2 같이 보기
- C++ regex_replace()
- [[ ]]
- [[ ]]
- [[ ]]
- [[ ]]
- [[ ]]
3 참고
- 위키백과 "C++ regex search()"
위키낱말사전 "C++ regex search()"
- 다음사전 "C++ regex search()"
- 다음백과 "C++ regex search()"
- 네이버사전 "C++ regex search()"
네이버백과 "C++ regex search()"
나무위키 "C++ regex search()"
- 리브레 위키 "C++ regex search()"
[[분류: ]] [[분류: ]]
편집자 Jmnote
로그인하시면 댓글을 쓸 수 있습니다.