正则表达式
工具网站
- Online regex tester and debugger: PHP, PCRE, Python, Golang and JavaScript
- RegExr: 学习、构建 和 测试 正则表达式 Test RegEx
^apple\..{3,}$ ^ $ 文件名的起始位置和结束位置 .{3,} 三个或更多的任意字符
常见的正则表达式 . * + [abc] (RX1|RX2) ^ $ 含义?
$0↔ 引用匹配到结果abc…↔ 字母123…- Digits
\d↔ Any Digit- 等价于 →
[0-9] - 匹配3个数字 →
\d{3} - 匹配一个或多个数字 →
\d+
- 等价于 →
\D↔ Any Non-digit character.↔ 除空格之外的”任意单个字符”*↔ 匹配前面字符零次或多次+↔ 匹配前面字符一次或多次\.Period[abc]↔ Only a, b, or c[^abc]↔ Not a, b, nor c[a-z]↔ Characters a to z[0-9]↔ Numbers 0 to 9\w↔ Any Alphanumeric character\W↔ Any Non-alphanumeric character{m}↔ m Repetitions{m,n}↔ m to n Repetitions?↔ Optional character\s↔ Any Whitespace\S↔ Any Non-whitespace character^、$↔ Starts and ends(…)Capture Group ↔$1第一个匹配结果(a(bc))↔ Capture Sub-group(.*)↔ Capture all|或,(abc|def)↔ 任何能够匹配abc 或 def的结果
获取 hdfs 地址中的路网 (\d{10})
sublime 正则匹配提取
- 打开搜索框,然后输入正则表达式,最后Find All 就可以复制
[[Ref]]