正则表达式

基本正则表达式
基本正则表达式( 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

相关推荐
CappuccinoRose12 小时前
数据库安全性与完整性 - 软考备战(三十三)
数据库·mac·软考·dac·实体完整性·参照完整性·用户定义完整性
2401_8836002512 小时前
SQL处理分组聚合中的数据一致性_使用事务保证
jvm·数据库·python
weixin_4087177712 小时前
为什么宝塔面板定时访问URL任务总是报502_检查目标接口响应时间与延长任务执行超时设置
jvm·数据库·python
木雷坞12 小时前
2026年4月实测:K8s containerd 镜像拉取全方案汇总
运维·容器·kubernetes
℡終嚸♂68012 小时前
Vite 开发服务器文件读取 Writeup
运维·服务器·状态模式
m0_7467523012 小时前
如何在导航栏中实现左右分列的菜单项布局
jvm·数据库·python
214396512 小时前
怎么为MongoDB事务调优:将读操作尽量移到事务外面执行
jvm·数据库·python
小苗卷不动12 小时前
UDP服务端收发流程
linux·c++·udp
baidu_3409988212 小时前
JavaScript中函数式编程中不可变性与闭包的关联
jvm·数据库·python
djjdjdjdjjdj12 小时前
c++如何利用std--tie实现多个文件属性字段的快速比较排序【详解】
jvm·数据库·python