正则表达式

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

相关推荐
MZZDX23 分钟前
MySQL相关知识总结
数据库·mysql
爱装代码的小瓶子24 分钟前
Linux下的权限与文件
linux·运维·服务器
ggaofeng1 小时前
linux中mount的本质是什么?自己如何实现一个伪文件系统
linux·mount·自己实现伪文件系统
敲上瘾1 小时前
Linux系统C++开发环境搭建工具(二)—— etcd 使用指南
linux·c++·etcd
励志不掉头发的内向程序员1 小时前
【Linux系列】解码 Linux 内存地图:从虚拟到物理的寻宝之旅
linux·运维·服务器·开发语言·学习
Fuly10241 小时前
使用docker本地部署dify
运维·docker·容器
青山撞入怀11142 小时前
sql题目练习——聚合函数
数据库·sql
woshihonghonga2 小时前
停止Conda开机自动运行方法
linux·人工智能·conda
disanleya2 小时前
MySQL默认端口为何是3306?修改后如何管理?
数据库·mysql·adb