我需要编写一些javascript来从url中删除hostname:port部分,这意味着我只想提取路径部分.
即我想编写一个函数getPath(url),使getPath(" http:// host:8081/path/to/something ")返回"/ path/to/something"
可以使用正则表达式完成吗?
javascript regex
javascript ×1
regex ×1