![](/img/trans.png)
[英]How to set a page within a folder to the URL localhost: port-number?
[英]How to modify URL regex to also match 'localhost' and 'localhost:port'?
在尋找 URL 驗證的正則表達式時,我發現此示例https://gist.github.com/dperini/729294適合我的需求。 但我還必須驗證true
URL,例如http://localhost:5000/#orders:ORD-2
或http://localhost/#orders:ORD-2
。 請幫我修改原始正則表達式,以便它可以將普通 URL 和 URL 與localhost
或localhost
與port
匹配。
這個正則表達式可以嗎? 它與您提供的匹配,但我不確定是否需要匹配更多匹配項。
^http:\/\/(localhost|port)(:\d+)?\/#orders:ORD-2$
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.