DEELX 正则引擎编程帮助

DEELX是一款简洁高效的C++正则表达式引擎,仅通过一个头文件即可轻松集成,支持模板类CRegexpT及MatchResult类等多种功能,便于开发者快速实现正则匹配需求。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

C++ 环境下的正则表达式引擎,RegExLab 的研究开发项目。


概述

DEELX 的移植和使用非常简单,DEELX 的所有代码只有一个头文件(deelx.h),include 该头文件即可。

不需要为 DEELX 创建 project,也不需要添加任何 cpp 或者静态库 lib 文件。运行时,也不依赖专门的动态库。由于 deelx.h 已经直接包含到你的项目中,因此不会存在 Runtime Library 与主项目不同的问题,也不用担心会产生连接错误的问题。


目录
  1. CRegexpT 模板类
    1. 构造方法
    2. Compile 方法
    3. MatchExact 方法
    4. Match 方法
    5. GetNamedGroupNumber 属性
    6. PrepareMatch 方法
    7. Replace 方法
    8. ReleaseContext 方法
    9. ReleaseString 方法
       
  2. MatchResult 类
    1. IsMatched 属性
    2. GetStart 属性
    3. GetEnd 属性
    4. GetGroupStart 属性
    5. GetGroupEnd 属性
    6. MaxGroupNumber 属性
       
  3. CContext 类

参见

[ 正则表达式语法] - 详细介绍 DEELX 支持的正则表达式语法。

[ 表达式工具 Match Tracer] - 推荐使用正则表达式可视化编写及调试工具。

 
options: -s single-line mode -m multi-line mode -i ignoreCase -G global -R from right to left -E extended-regexp pattern ERE -e ="PAT-regexp" -C ="strToOperate" -F fixed-strings fgrep -c ="num" print only a count of matching first lines per file -n force the prefixing filename on output -N without prefixing filename on output -o show only the part of the line that matched -f ="file" read regex patterns from file -q quiet suppress all normal output,stderr etc -O output file offsets, not text -x print line number with output lines -r recursively scan sub-directories -I select only non-matching lines -S ="replaceto" Match(regexp)-->replaceto -p ="bak-suffix-name",Modify file(S) directly,will create backup file(s) if bak- suffix-name is not null -d ="dir to search" default=currentDirectory,dir-str can't end with \",avoid esc ape " -X mask filename to be operated with regex -T only output filename and match num for per file search file:if set the -e arg and no (-C arg || stdin-pipe || inputfile),then ou tput filepath that match -ergx;if -o arg is set,output filenames only 从命令行中-C参数指定要处理的字符串: C:\>E:\MyProjects1117\deelxGrepSed\Debug\deelxgrep.exe -Chello2012 -e2\d+2 Line:1 Offset:5 hello2012 //output -o参数指定只输出匹配部分: C:\>E:\MyProjects1117\deelxGrepSed\Debug\deelxgrep.exe -Chello2012 -e2\d+2 -o 2012 从标准输入 管道里获取要处理的数据 C:\>help |E:\MyProjects1117\deelxGrepSed\Debug\deelxgrep.exe -e^V.+?\s -o VERT VE VER VER VERIFY VOL 从文件里读取数据处理,支持递归处理目录 E:\MyProjects1117\deelxGrepSed\Release>deelxgrep.exe -ewindows Boo-t.ini -i Boo-t.ini result : Line:3 Offset:45 (0)partition(1)\WINDOWS [operating sys Line:5 Offset:37 (0)partition(1)\WINDOWS="Microsoft Wind Line:5 Offset:56 DOWS="Microsoft Windows XP Professional -d指定目录,-r表示递归处理 -e指定要查找的表达式,如果没有带处理数据(即没有-C\管道输入\指定文件)但指定了目录,则会 处理目录下的目录名和文件名,并输出符合表达式的路径名称 E:\MyProjects1117\deelxGrepSed\Release>deelxgrep.exe -eboot.i*i -i -d"c:" -r c:\boot.ini E:\MyProjects1117\deelxGrepSed\Release>deelxgrep.exe -eboot.i*i -i -d"c:\\"
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值