加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

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

发布时间:2020-12-14 02:27:04 所属栏目:百科 来源:网络整理
导读:#include pcre.h int pcre_exec(const pcre * code ,const pcre_extra * extra ,const char * subject ,int length ,int startoffset ,int options ,int * ovector ,int ovecsize ); DESCRIPTION This function matches a compiled regular expression again

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读