0

Can someone please post a regex to extract domain from a url confirming RFC 1738 (http://www.ietf.org/rfc/rfc1738.txt)?

PROTOCOL://USERNAME:PASSWORD@DOMAINNAME:PORT/QUERYSTRING

Example:

https://abc:[email protected]:777/question/index?qid=20100728205639

Thanks, Sumit

user3802925
  • 81
  • 1
  • 5

1 Answers1

0

You can find one such regular expression here. You can probably simplify it, but that depends entirely on your needs.

You can also use a library which provides functions for parsing URLs. A good starting point is this Stack Overflow thread: Easy way to parse a url in C++ cross platform?

Community
  • 1
  • 1
Boaz Yaniv
  • 6,334
  • 21
  • 30