正则表达式

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

相关推荐
白露与泡影21 分钟前
使用systemd,把服务装进 Linux 心脏里~
linux·运维·python
CQ_YM29 分钟前
Linux管道通信
linux·c语言·管道·ipc·管道通信
<花开花落>1 小时前
Cursor 的 MCP 应用:mysql-mcp-server
mysql·cursor·mcp
l1t1 小时前
用docker安装oracle 19c
运维·数据库·docker·oracle·容器
Java&Develop1 小时前
DataEase图表页面传参至数据库查询方法 和页面筛选方法 sql传参
数据库·sql
Boilermaker19921 小时前
[MySQL] 设计范式与 E-R 图绘制
mysql·oracle·设计规范
+VX:Fegn08951 小时前
计算机毕业设计|基于springboot + vue作业管理系统(源码+数据库+文档)
数据库·vue.js·spring boot·后端·课程设计
卡尔特斯1 小时前
MySQL 字符集与排序规则总结
mysql
luoluoal1 小时前
基于python的RSA算法的数字签名生成软件(源码+文档)
python·mysql·django·毕业设计
@zulnger1 小时前
Python 连接 MySQL 数据库_pymysql
数据库·python·mysql