正则表达式

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

相关推荐
ss2731 天前
手写Spring第7弹:Spring IoC容器深度解析:XML配置的完整指南
java·前端·数据库
pusue_the_sun1 天前
操作系统:进程的短程调度
运维·服务器
landian0041 天前
kubuntu24.04 换国内ustc源
linux·kubuntu24.04
七度光阴;1 天前
Docker入门手册
运维·docker·容器
PFinal社区_南丞1 天前
PostgreSQL-10个鲜为人知的强大功能
数据库·后端
misty youth1 天前
配置openguass 教程(自存)
数据库·ubuntu·华为·openguass
知识分享小能手1 天前
uni-app 入门学习教程,从入门到精通,uni-app 基础知识详解 (2)
前端·javascript·windows·学习·微信小程序·小程序·uni-app
DuHz1 天前
C程序中的数组与指针共生关系
linux·c语言·开发语言·嵌入式硬件·算法
shuair1 天前
mysql8支持远程访问 -mysql5.7支持远程访问
linux·mysql
瑞士卷@1 天前
MyBatis入门到精通(Mybatis学习笔记)
java·数据库·后端·mybatis