开发者

Boost RegEx to parse url (RFC 1738) to extract domain name

开发者 https://www.devze.com 2023-03-06 01:08 出处:网络
Can someone please post a regex to extract domain from a url confirming RFC 1738 (http://www.ietf.org/rfc/rfc1738.txt)?

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:password@answers.yahoo.com:777/question/index?qid=201007开发者_C百科28205639

Thanks, Sumit


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?

0

精彩评论

暂无评论...
验证码 换一张
取 消