Advertisement

轮子哥课程(第1期)

阅读量:

留存一份由轮子哥编写的高水准代码示例,便于日后查阅与借鉴

复制代码
    #include <iostream>
    #include <string>
    #include <regex>
    
    using namespace std;
    
    int main()
    {
    string line;
    regex email(R"(\w+@(\w+\.)+\w+)");
    while(getline(cin,line))
    {
        smatch matches;
        auto current = cbegin(line);
        auto last = cend(line);
        while(current!=last)
    
        {
            if(regex_search(current,last,matches,email))
            {
                ssub_match match = matches[0];
                current=match.second;
                cout<<match.str()<<endl;
            }

全部评论 (0)

还没有任何评论哟~