1、为什么使用pcre而不是用自身的标准库regex?
引用:
PCRE benefits from some optimizations known as start-up optimizations which are configured to be enabled by default. These optimizations include:
- A subject pre-scan for unanchored patterns (if a starting point is not found engine doesn't even bother to go through matching process.)
- Studying pattern to ensure that minimum length of subject is not shorter than pattern itself
- Auto-possessification
- Fast failure (if a specific point is not found engine doesn't even bother to go through matching process.)
2、使用步骤
- 下载pcre,可以是源码,也可以是编译好的文件
- 添加头文件引用 ,注意要加宏
#define PCRE_STATIC #include "pcre/pcre.h"
- 添加库引用,注意库路径,或者在工程里加