轉載:https://blog.csdn.net/fsdad/article/details/52637426
判斷url是否合法
const std::regex urlpattern("^(((file|gopher|news|nntp|telnet|http|ftp|https|ftps|sftp)://)|(www\.))+(([a-zA-Z0-9\._-]+\.[a-zA-Z]{2,6})|([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}))(/[a-zA-Z0-9\&%_\./-~-]*)?$"); if (regex_match(strUrl.c_str(), urlpattern)) { //合法url } else { //非法url }