正则表达式

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

相关推荐
SKH.2 分钟前
Linux软件编程(5)线程
java·linux·jvm
JuiceFS4 分钟前
如何通过 S3 和 WebDAV 协议访问 JuiceFS?
运维·人工智能·后端
csdn_aspnet5 分钟前
mysql 函数、存储过程写法及示例
数据库·mysql·存储过程·函数·function·procedure
IvorySQL5 分钟前
倒计时 6 天!PGConf.Asia 2026 演讲征集即将截止
数据库·人工智能·postgresql
mounter62512 分钟前
重构 Kexec Handover:Linux 内核如何将 KHO 打造为无状态、可重入的跨重启交接基石
linux·内存管理·linux kernel·kernel·liveupdate
云贝贝贝21 分钟前
OceanBase 生产运维 7 个高频现场:从连不上到误删兜底
运维·ffmpeg·oceanbase
qyyyyy57025 分钟前
PDF 转 JSON 怎么做?从表格和元数据提取到 LLM 结构化处理
数据库·pdf·json·erlang·llama
今天AI了吗25 分钟前
从“金鱼脑”到“大象记忆”:AI Agent 短期记忆与长期记忆的存储与检索全解
数据库·人工智能·python·sql·rust
南讯股份Nascent33 分钟前
电商全域 CRM 技术拆解:以 KEDAO-CRM 为例看 One ID 与营销自动化的落地实践
运维·自动化
Java小白笔记43 分钟前
Codex CLI 使用与斜杠指令实战教程
服务器·数据库·oracle