Trying to get base url with reg ex
I need to map the "base" URL, which I mean:
Not match --> http://google.com
Not match --> http://www.google.com
Not match --> www.google.com
Match! --> google.com
I tried to use a negative look to make sure there was no http: // or www, but it does not seem to work correctly.
Should it be with just one regex?
You may have the first regex that matches all the URLs found. Something like that:
\b.+?\.\w{2,4}\b
And then filter out all matches and save those that don't match the following:
^(http://|www)
although, frankly, I would not use Regex if it was not strictly necessary for this.
:
URL-. , http:// www, . , URL-, :
yesterday.but I was there yesterday.but no one saw me