正则表达式

基本正则表达式
基本正则表达式( Basic Regular Expression , BRE ),又称为标准正则表达式,是最早制订的正则表达
式规范,仅支持最基本的元字符集。基本正则表达式是 POSIX 规范制订的两种正则表达式语法标准之
一,另外一种语法标准称为扩展正则表达式。

root@shell shell\] # grep \^a /etc/passwd \[root@shell shell\] # grep h$ /etc/passwd \[root@shell shell\] # grep . /etc/passwd \[root@shell shell\] # grep ro\* /etc/passwd \[root@shell shell\] # grep "ro\\{1,2\\}" /etc/passwd \[root@shell shell\] # grep "ro\\{1\\}" /etc/passwd \[root@shell shell\] # grep \[a-zA-Z\] /etc/passwd \[root@shell shell\] # grep \[a-Z\] /etc/passwd \[root@shell shell\] # grep \[0-9\] /etc/passwd \[root@shell shell\] # grep \[0-9a-Z\] /etc/passwd 或者 grep \[\[:alnum:\]

/etc/passwd

root@shell shell\] # grep \[\[:space:\]\] /etc/passwd \[root@shell shell\] # grep \[\^a\] /etc/passwd \[root@shell shell\] # grep \^\[ab\] /etc/passwd \[root@shell shell\] # grep "\\." file \[root@shell shell\] # grep "\\(root\\).\*\\1" file \[root@shell shell\] # grep "ly\\\>" file \[root@shell shell\] # grep "\\\" file love \[root@shell shell\] # grep "\\blove\\b" file love 扩展正则 ![](https://i-blog.csdnimg.cn/direct/68c205727c3f475e94a3b1b43b60f91c.png) \[root@shell shell\] # grep -E ro? /etc/passwd \[root@shell shell\] # grep -E ro+ /etc/passwd \[root@shell shell\] # grep -E "(root\|adm\|ssh)" /etc/passwd

相关推荐
IT研究所4 分钟前
信创浪潮下 ITSM 的价值重构与实践赋能
大数据·运维·人工智能·安全·低代码·重构·自动化
代码AI弗森5 分钟前
WSL2:在 Windows 上获得一整套可托付的 Linux 工程环境
linux·运维·服务器
不会代码的小猴6 分钟前
Linux环境编程第五天笔记
linux·笔记
shejizuopin19 分钟前
基于SSM的高校旧书交易系统的设计与实现(毕业论文)
java·mysql·毕业设计·论文·ssm·毕业论文·高校旧书交易系统的设计与实现
玉梅小洋20 分钟前
Docker 镜像在节点间的高效拷贝的方案
运维·docker·容器
tkevinjd21 分钟前
6-MySQL
mysql
invicinble23 分钟前
Mysql的全域认识
数据库·mysql
OceanBase数据库官方博客23 分钟前
DeepK 自动程序修复框架论文——OceanBase 校企联合研究
数据库·oceanbase·分布式数据库
firstacui26 分钟前
搭建harbor仓库
linux·docker
niceffking28 分钟前
Linux信号相关函数
linux·运维·服务器·linux信号