正则表达式

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

相关推荐
戒不掉的伤怀16 分钟前
【Navicat 连接MySQL时出现错误1251:客户端不支持服务器请求的身份验证协议;请考虑升级MySQL客户端】
服务器·数据库·mysql
超喜欢下雨天16 分钟前
服务器安装 ros2时遇到底层库依赖冲突的问题
linux·运维·服务器·ros2
cv高级工程师YKY21 分钟前
服务器 - - QPS与TPS介绍
数据库
搬码临时工22 分钟前
小企业如何搭建本地私有云服务器,并设置内部网络地址提供互联网访问
运维·服务器
nbsaas-boot29 分钟前
高可扩展属性建模设计:架构师的全局思考与落地方案
数据库
old-six-programmer41 分钟前
NAT 类型及 P2P 穿透
服务器·网络协议·webrtc·p2p·nat
爱上语文1 小时前
Redis基础(5):Redis的Java客户端
java·开发语言·数据库·redis·后端
tan77º1 小时前
【Linux网络编程】网络基础
linux·服务器·网络
风口上的吱吱鼠1 小时前
Armbian 25.5.1 Noble Gnome 开启远程桌面功能
服务器·ubuntu·armbian
18你磊哥1 小时前
Windows 本地安装部署 Apache Druid
运维·debian