#include <pcre.h>
int pcre_exec(const pcre *code,const pcre_extra *extra,const char *subject,intlength,intstartoffset,intoptions,int *ovector,intovecsize);
DESCRIPTIONThis function matches a compiled regular expression against a given subject string,using a matching algorithm that is similar to Perl's. It returns offsets to captured substrings. Its arguments are:
code Points to the compiled pattern extra Points to an associated pcre[16|32]_extra structure,or is NULL subject Points to the subject string length Length of the subject string,in bytes startoffset Offset in bytes in the subject at which to start matching options Option bits ovector Points to a vector of ints for result offsets ovecsize Number of elements in the vector (a multiple of 3)
上述的API介绍为Pcre官网的介绍,大致翻译为
该函数从给予的Subject中匹配一个编译后的正则表达式,使用和Perl相似的匹配算法。该函数返回匹配的子串的偏移量