Can a URL contain a semicolon and still be valid?

前端 未结 7 1475
故里飘歌
故里飘歌 2020-11-30 04:47

I am using a regular expression to convert plain text URL to clickable links.

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

Ho

7条回答
  •  野趣味
    野趣味 (楼主)
    2020-11-30 05:13

    The semi-colon is a legal URI character; it belongs to the sub-delimiter category: http://www.ietf.org/rfc/rfc3986.txt

    However, the specification states that whether the semi-color is legitimate for a specific URI or not depends on the scheme or producer of that URI. So, if site using those links doesn't allow semi-colons, then they're not valid for that particular case.

提交回复
热议问题