Hello,
#include <iostream>
#include <algorithm>
#include<boost/algorithm/string.hpp>
#include<boost/regex.hpp>
using namespace std;
using namespace boost;
string _getBasehtttp(string url)
{
regex exrp( "^(?:http://)?([^\\/]+)(.*)$" );
match_results<string::const_iterator> what;
if( regex_search( url, what, exrp ) )
{
string base( what[1].first, what[1].second );
return base;
}
return "";
}
int main( ) {
cout << _getBasehtttp("httpasd://www.google.co.in");
}
if i input http://www.google.co.in
i am getting returned as www.google.com
but if i input httpasd://www.google.co.in
i am getting httpasd
..there should not be any match na y i am getting the match ???