Properly Matching a IDN URL

前端 未结 3 1338
刺人心
刺人心 2020-12-04 00:42

I need help building a regular expression that can properly match an URL inside free text.

  • scheme
    • One of the follow
3条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-04 01:17

    This will get you most of the way there. If you need it more refined please provide test data.

    (ftp|https?)://([-\w\.]+)+(:\d+)?(/([\w/_\.]*(\?\S+)?)?)?
    

提交回复
热议问题