正则表达式

基本正则表达式
基本正则表达式( 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 "\<lo" file
root@shell shell # grep "\<love\>" file
love
root@shell shell # grep "\blove\b" file
love
扩展正则

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

相关推荐
螺丝钉tina10 小时前
[Playwright][08] Upload 模块自动化:如何设计真实业务测试用例?
运维·自动化·测试用例
迪菲赫尔曼10 小时前
【基础篇 12】把环境与源码接起来:检查 GPU,再安装服务器上的项目
运维·服务器·开发语言·人工智能·python·yolo·目标检测
cq林志炫10 小时前
两个Linux服务器之间同步文件
linux·运维·服务器
?re?ta?rd?ed?10 小时前
C++11新特性,{}与左值
c++·windows
瀚高PG实验室10 小时前
HGDB V9.0.5 .pgpass 免密登录提示 IsEncryptNon-base64 encoding 警告处理
数据库·postgresql·瀚高数据库
yyuuuzz10 小时前
云服务器安全组规则优先级的机制记录
运维·服务器·网络·安全·阿里云·aws
龙腾AI白云10 小时前
大模型检索增强生成(RAG)的技术原理与架构设计
数据库·python·机器学习·知识图谱
KaiwuDB10 小时前
KaiwuDB 运维实战06:数据库备份与恢复:从理论到实战
运维·数据库·时序数据库·kaiwudb
无人生还别怕11 小时前
如何搭建k8s服务(containerd部署)
linux·云原生·容器·kubernetes·openanolisos
智购科技自动售货机厂家11 小时前
让AI经营自动售货机:从Project Vend看工具权限与业务规则~YH
大数据·服务器·单片机·嵌入式硬件·深度学习