代码编译成功后,怎么什么也没输出?

 #include<iostream>
using namespace std;
#include<regex>
int main()
{
    string str("0\d\d-\d\d\d\d\d\d\d\d");  
    string text("050-83208815");    
    regex ex(str); 
    sregex_iterator it(text.begin(),text.end(),ex);    
    sregex_iterator end_it;    
    for (;it!=end_it;++it)  
    {   
            cout<<it->str()<<endl;         
             //cout<<(*it)[0]<<endl;    
      } 
      return 0;
}  

检查一下正则表达式是否正确,试试str中的横杠前加反斜杠转义。

我这里没有调式的工具 不过你确定 main()方法执行了? 还是for循环没执行?