FrankKai.github.io
FrankKai.github.io copied to clipboard
正则表达式
- 正则表达式速查表
- JavaScript中的正则
- 工作中遇到的正则表达式
正则表达式速查表
https://regexr.com/
JavaScript中的正则
- String.prototype.replace() / replaceAll()
- String.prototype.match() / matchAll()
- String.prototype.search()
- String.prototype.split()
- RegExp object
工作中遇到的正则表达式
- 匹配.jpg或.jpeg
/\.jpe?g$/
- 匹配11位手机号
/1\d{10}/
- 匹配尾缀0 "12000".match(/0+$/) // ["000", index input group]