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

来源:互联网 发布:方维众筹系统源码1.7 编辑:程序博客网 时间:2024/04/28 06:29

近日要做一个从网页提取信息的软件,但是找的那些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}都不能出现。。。找个好的库来用也不行啊。。。