Regex Tutorial
Regex learning reference
使用说明
Regex Tutorial provides systematic regex learning reference. Covers basic syntax, quantifiers, groups, character classes, anchors, and modifiers with rich examples. Suitable for both beginners and experienced developers to quickly master regex writing techniques.
Basic Match
.匹配任意单个字符(除换行符)\d匹配数字 [0-9]\w匹配字母数字下划线\s匹配空白字符\D匹配非数字\W匹配非字母数字下划线\S匹配非空白字符Quantifier
*0次或多次+1次或多次?0次或1次{n}恰好n次{n,}至少n次{n,m}n到m次Boundary & Anchor
^行首$行尾\b单词边界\B非单词边界Group & Reference
(abc)捕获分组(?:abc)非捕获分组\1反向引用第1组(?=abc)正向前瞻(?!abc)负向前瞻Character Class
[abc]匹配a/b/c中任一[^abc]匹配非a/b/c[a-z]匹配小写字母[A-Z]匹配大写字母[0-9]匹配数字Modifier
g全局匹配i不区分大小写m多行模式s单行模式(.匹配换行)