boost正则表达式库regex库和xpressive库关于零宽断言的问题

作者尝试使用Boost库中的regex和xpressive进行网页信息提取,但遇到零宽断言使用限制的问题,详细介绍了零宽断言中不可使用不定长表达式的规则。

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

近日要做一个从网页提取信息的软件,但是找的那些html解析器总是出错,这里我就不点名指出htmlcxx了。。。所以只能自己写一个。用boost的regex库或者xpressive库,编译通过了,但是运行总是抛出异常,后来错误锁定了零宽断言。翻查资料找到如下一段


(?<=pattern) consumes zero characters, only if pattern could be matched against the characters preceding the current position (pattern must be of fixed length).

(?<!pattern) consumes zero characters, only if pattern could not be matched against the characters preceding the current position (pattern must be of fixed length).

也就是说零宽断言里不能有不定长的表达式,故+,*,?,{m,n}都不能出现。。。找个好的库来用也不行啊。。。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值