本文主要实现多次匹配,来扫描文件内的敏感信息(正则匹配),并算出扫描所需要的时间。新手,可能有些地方有错误。
#define PCRE_STATIC // 静态库编译选项
#include <stdio.h>
#include <string.h>
#include "pcre.h"
#include<windows.h>
#include<iostream>
using namespace std;
#define OVECCOUNT 30 /* should be a multiple of 3 */
#define EBUFLEN 128
#define BUFLEN 1024
int main()
{
pcre *re;
const char *error;
int erroffset;
int ovector[OVECCOUNT];
int rc;
int i = 0;
//char src[] = "qwertyuioaaqqq"; // 要被用来匹配的字符串
char pattern[] = "aa";
FILE* fp=NULL;
if (0 != fopen_s(&fp, "1.txt", "rb+"))
{
printf("Can not open file.\n");
return 0;
}
char*