当前位置:网站首页>shell脚本——正则表达式
shell脚本——正则表达式
2022-07-28 05:28:00 【渔火鳅】
shell脚本——正则表达式
一、正则表达式概述
1、正则表达式的概念
通常用于判断语句中,用来检查某一字符串是否满足某一格式
正则表达式分为基础正则表达式与扩展正则表达式
它不是一个工具程序,而是一个字符串处理的标准依据
使用单个字符串搜索、匹配一系列符合某个语法规则的字符串
它是由普通字符(a~z),以及特殊字符(又叫“元字符”)组成
普通字符包括大小写字母、数字、标点符号及一些其他符号
元字符是指再正则表达式中具有特殊意义的专用字符,可以用来规定其前导字符(即位于元字符前面的字符)在目标对象中的出现模式
2、正则表达式支持的Linux文本处理工具

#grep和awk应用于扩展正则表达式
grep -E
awk -r
3、基础正则表达式常见的字符
支持的工具:grep、egrep、sed、awk

4、扩展正则表达式元字符

5、正则表达式匹配E-mail地址
用户名@
^([a-zA-Z0-9_-.+]+)@
子域名
([a-zA-Z0-9_-.]+)
顶级域名
.([a-zA-Z]{2,5})$
a-zA-Z0-9_-.]+)
顶级域名
.([a-zA-Z]{2,5})$
边栏推荐
- Analysis of cyclicbarrier source code of AQS
- HDU-1159-CommonSubsequence(LCS最长公共子序列)
- Ten thousand words summarize and realize the commonly used sorting and performance comparison
- Compilation and preprocessing of C language
- Technology sharing | do you know the functions of the server interface automated testing and requests library?
- DNS domain name resolution service
- It is recommended to wear air conduction earphones, which do not need to wear in ear
- Hdu-1159-commonsubsequence (LCS longest common subsequence)
- 测试面试题集锦(一)| 软件测试常见必考问题与流程篇(附答案)
- 测试面试题集锦(二)| 测试工具篇(附答案)
猜你喜欢

技术分享 | 接口测试常用代理工具

Which brand of air conduction earphones is better? These four should not be missed

iptables防火墙

Compilation and preprocessing of C language

浅谈Cookie和Session

Analysis of the semaphore source code of AQS

NFS shared storage service

raid磁盘阵列

Prometheus monitoring Nacos

Build php7 private warehouse
随机推荐
Iptables firewall
技术分享 | 如何模拟真实使用场景?mock 技术来帮你
File operation in C language
On cookies and session
NFS shared storage service
Si Han talks about the professional development of testers
SSH service configuration
Test interview questions collection (II) | test tools (with answers)
HDU-5783 Divide the Sequence(贪心水题)
浅谈Cookie和Session
修复故障扇区
Pku-2524-ubiquitous relations (parallel search template)
Test interview questions collection (I) | common required questions and procedures of software testing (with answers)
DNS domain name resolution service
什么是线性表?
进程和线程的区别
Prometheus monitoring Nacos
Tcp/ip five layer model
Technology sharing | detailed explanation of actual combat interface test request methods get, post
HDU-1159-CommonSubsequence(LCS最长公共子序列)