3 Star 54 Fork 14

Yaohaixiao / dom.js

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
_getURLPattern.js 743 Bytes
AI 代码解读
一键复制 编辑 原始数据 按行查看 历史
const _getURLPattern = () => {
const protocol = '(\\w+:)?'
const user = '([^\\/\\?\\#\\:]+)'
const password = '(.+)'
const auth = '(' + user + ':' + password + '@)?'
const address = '(([a-z\\d]([a-z\\d-]*[a-z\\d])*(\\.[a-z]{2,})?)+)'
const ip = '((\\d{1,3}\\.){3}\\d{1,3})'
const hostname = '(' + address + '|' + ip + ')'
const port = '(\\:\\d+)?'
const host = '(' + hostname + port + ')'
const pathname = '((\\/[-a-z\\d%_.~+]*)*)'
const search = '(\\?[;&a-z\\d%_.~+=-]*)?'
const path = '(' + pathname + search + ')*'
const hash = '(\\#[-a-z\\d_]*)?'
const pattern = '^' + protocol + '\\/\\/' + auth + host + path + hash + '$'
return new RegExp(pattern, 'i')
}
export default _getURLPattern
JavaScript
1
https://gitee.com/yaohaixiao/dom.js.git
git@gitee.com:yaohaixiao/dom.js.git
yaohaixiao
dom.js
dom.js
main

搜索帮助