正则表达式

2021/06/02 正则 备忘 共 555 字,约 2 分钟

参考🔗:https://regexone.com

Lesson Notes:

abc…letters
123…digits
\dAny Digit
\DAny Non-digit character
.Any 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
\wAny Alphanumeric character
\WAny Non-alphanumeric character
{m}m Repetitions
{m,n}m to n Repetitions
*Zero or more repititions
+One or more repititions
?Optional character
\sAny Whitespace
\SAny Non-whitespace character
^…$Starts and ends
(…)Capture Group
(a(bc))Capture Sub-group
(.*)Capture all
(abc|def)Matches abc or def
\bMartches the boundary between a word and a non-word character
\0,\1,\2…Reference your captured groups

文档信息

Search

    Table of Contents