浅尝'则'止: 正则
Screenshot from LEARN REGEX.
- [a-z0-9] 与 (a-z0-9)的区别, []是chracter class, 只匹配一个字符, ()代表匹配组, 这个例子只能匹配’a-z0-9’
- 前向/后向断言
- 例子
“(T | t)he(?=sfat)” => The fat cat sat on the mat. | |
“(T | t)he(?!sfat)” => The fat cat sat on the mat. | |
”(?<=(T | t)hes)(fat | mat)” => The fat cat sat on the mat. |
”(?<!(T | t)hes)(cat)” => The cat sat on cat. |
- Flag
- 搭建引擎
相关资源:
正则表达式可视化: regexer
正则表达式: Regulex
正则在线调试: regex101
正则在线答题: regexone
Enjoy Reading This Article?
Here are some more articles you might like to read next: