正则表达式是一种描述一组字符串的模式,为处理大量文本、字符串而定义的一套规则和方法,以行为单位进行处理。正则表达式分为两类:基本正则表达式(BRE)和扩展正则表达式(ERE)。在linux中使用正则表达式较多的有三个工具,分别为grep,sed和awk,这三个工具被称为linux文本处理的三剑客。
[1-9][0-9]KaTeX parse error: Expected 'EOF', got '\d' at position 18: …//正整数 3、“^((-\̲d̲+)|(0+))” //非正整数(负整数 + 0)
4、“^-[0-9][1-9][0-9]KaTeX parse error: Expected 'EOF', got '\d' at position 17: … //负整数 5、“^-?\̲d̲+” //整数
6、“^\d+(.\d+)?KaTeX parse error: Can't use function '\.' in math mode at position 35: … 7、“^(([0-9]+\̲.̲[0-9]*[1-9][0-9…” //正浮点数
8、“^((-\d+(.\d+)?)|(0+(.0+)?))KaTeX parse error: Can't use function '\.' in math mode at position 36: … 9“^(-(([0-9]+\̲.̲[0-9]*[1-9][0-9…” //负浮点数
10、“^(-?\d+)(.\d+)?
”
/
/
浮
点
数
11
、
“
[
A
−
Z
a
−
z
]
+
” //浮点数 11、“^[A-Za-z]+
”//浮点数 11、“[A−Za−z]+” //由26个英文字母组成的字符串
12、“1+
”
/
/
由
26
个
英
文
字
母
的
大
写
组
成
的
字
符
串
13
、
“
[
a
−
z
]
+
” //由26个英文字母的大写组成的字符串 13、“^[a-z]+
”//由26个英文字母的大写组成的字符串 13、“[a−z]+” //由26个英文字母的小写组成的字符串
14、“2+KaTeX parse error: Expected group after '^' at position 29: …字母组成的字符串 15、“^̲\w+” //由数字、26个英文字母或者下划线组成的字符串
16、3+([-_.][A-Za-z\d]+)@([A-Za-z\d]+[-.])+[A-Za-z\d]{2,4}$ 邮箱
17、“4+://(\w+(-\w+))(.(\w+(-\w+)))(?\S)?KaTeX parse error: Expected 'EOF', got '\d' at position 17: … //url 18、/^(\̲d̲{2}|\d{4})-((0(…/ // 年-月-日
19、/^((0([1-9]{1}))|(1[1|2]))/((0-2)|(3[0|1]))/(d{2}|d{4})
/
/
/
月
/
日
/
年
20
、
“
(
[
w
−
.
]
+
)
@
(
(
[
[
0
−
9
]
1
,
3
.
[
0
−
9
]
1
,
3
.
[
0
−
9
]
1
,
3
.
)
∣
(
(
[
w
−
]
+
.
)
+
)
)
(
[
a
−
z
A
−
Z
]
2
,
4
∣
[
0
−
9
]
1
,
3
)
(
]
?
)
/ // 月/日/年 20、“^([w-.]+)@(([[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.)|(([w-]+.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(]?)
/ //月/日/年 20、“([w−.]+)@(([[0−9]1,3.[0−9]1,3.[0−9]1,3.)∣(([w−]+.)+))([a−zA−Z]2,4∣[0−9]1,3)(]?)” //Email
21、/^((+?[0-9]{2,4}-[0-9]{3,4}-)|([0-9]{3,4}-))?([0-9]{7,8})(-[0-9]+)?$/ //电话号码