September 13th, 2009, 04:26 PM
Join Date: Jul 2001
Time spent in forums: 20 h 32 m 5 sec
Reputation Power: 12
I'm a little rusty with my regex and there might be something simpler you could use, but try:
Also, AFAIK, domain names don't typically include underscores. You're out of luck if you're trying to match ip addresses with this expression, or if the user ends the domain with / or whatever. I don't really know where you're getting your data from, though, so it's difficult to say whether or not this will be a problem for you.
I tried this against the following (some of which are random domains, some real), and the expression worked out against all of them: