C语言开源正则表达式库-----PCRE

前端之家收集整理的这篇文章主要介绍了C语言开源正则表达式库-----PCRE前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

#include <pcre.h>

int pcre_exec(const pcre *code,const pcre_extra *extra,const char *subject,intlength,intstartoffset,intoptions,int *ovector,intovecsize);

DESCRIPTION

This 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相似的匹配算法。该函数返回匹配的子串的偏移量

猜你在找的正则表达式相关文章