声明:本站文章均为作者个人原创,图片均为实际截图。如有需要请收藏网站,禁止转载,谢谢配合!!!

1、验证是否符合

const regExp = /^http(s?):\/\/badianboke.com$/
string.test(regExp) // true false

2、取出匹配结果

const string = https://badianboke.com/666
const regExp = /^http(s?):\/\/badianboke.com(\d{3})$/
const result = string.match(regExp)
// result[0] => https://badianboke.com/666
// result[1] => s
// result[2] => 666



点赞(0) 打赏

评论列表 共有 0 条评论

暂无评论