Extract hostname name from string

后端 未结 28 2007
情歌与酒
情歌与酒 2020-11-22 07:15

I would like to match just the root of a URL and not the whole URL from a text string. Given:

http://www.youtube.co         


        
28条回答
  •  傲寒
    傲寒 (楼主)
    2020-11-22 08:02

    Parse-Urls appears to be the JavaScript library with the most robust patterns

    Here is a rundown of the features:

    Chapter 1. Normalize or parse one URL

    Chapter 2. Extract all URLs

    Chapter 3. Extract URIs with certain names

    Chapter 4. Extract all fuzzy URLs

    Chapter 5. Highlight all URLs in texts

    Chapter 6. Extract all URLs in raw HTML or XML

提交回复
热议问题