网址数据提取

#include <bits/stdc++.h>
using namespace std;
int main(){
    string you;
    cin>>you;
    smatch s;
    regex b(R"((^[a-zA-Z]+)://([a-zA-Z\d\.]+)/(\w+)\?(\w+)=(\d+))");
    if(regex_search(you,s,b)){
        cout<<s[0]<<endl<<s[1]<<endl<<s[2]<<endl<<s[3]<<endl<<s[5]<<endl;
    }
    
    return 0;
} 
//        https://chat.baidu.com/search?word=1111

 

posted @ 2025-10-01 09:28  付书恒  阅读(5)  评论(0)    收藏  举报