A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://www.ncbi.nlm.nih.gov/IEB/ToolBox/CPP_DOC/doxyhtml/pcre2demo_8c_source.html below:

NCBI C++ ToolKit: src/util/regexp/pcre2demo.c Source File

54 #define PCRE2_CODE_UNIT_WIDTH 8 69 int main

(

int

argc,

char

**argv)

103 for

(

i

= 1;

i

< argc;

i

++)

105  if

(

strcmp

(argv[

i

],

"-g"

) == 0) find_all = 1;

106  else if

(argv[

i

][0] ==

'-'

)

108

printf(

"Unrecognised option %s\n"

, argv[

i

]);

119

printf(

"Exactly two arguments required: a regex and a subject string\n"

);

152

printf(

"PCRE2 compilation failed at offset %d: %s\n"

, (

int

)erroroffset,

194  default

: printf(

"Matching error %d\n"

, rc);

break

;

205

printf(

"Match succeeded at offset %d\n"

, (

int

)ovector[0]);

218

printf(

"ovector was not big enough for all the captured substrings\n"

);

227 if

(ovector[0] > ovector[1])

229

printf(

"\\K was used in an assertion to set the match start after its end.\n" 230  "From end to start the match was: %.*s\n"

, (

int

)(ovector[0] - ovector[1]),

231

(

char

*)(

subject

+ ovector[1]));

232

printf(

"Run abandoned\n"

);

241 for

(

i

= 0;

i

< rc;

i

++)

244  PCRE2_SIZE

substring_length = ovector[2*

i

+1] - ovector[2*

i

];

245

printf(

"%2d: %.*s\n"

,

i

, (

int

)substring_length, (

char

*)substring_start);

264 if

(namecount == 0) printf(

"No named substrings\n"

);

else 267

printf(

"Named substrings\n"

);

287  for

(

i

= 0;

i

< namecount;

i

++)

289  int n

= (tabptr[0] << 8) | tabptr[1];

290

printf(

"(%d) %*s: %.*s\n"

,

n

, name_entry_size - 3, tabptr + 2,

291

(

int

)(ovector[2*

n

+1] - ovector[2*

n

]),

subject

+ ovector[2*

n

]);

292

tabptr += name_entry_size;

359  if

(ovector[0] == ovector[1])

361  if

(ovector[0] == subject_length)

break

;

376  if

(start_offset <= startchar)

378  if

(startchar >= subject_length)

break

;

379

start_offset = startchar + 1;

382  for

(; start_offset < subject_length; start_offset++)

383  if

((

subject

[start_offset] & 0xc0) != 0x80)

break

;

414  if

(options == 0)

break

;

415

ovector[1] = start_offset + 1;

416  if

(crlf_is_newline &&

417

start_offset < subject_length - 1 &&

418  subject

[start_offset] ==

'\r'

&&

419  subject

[start_offset + 1] ==

'\n'

)

423  while

(ovector[1] < subject_length)

425  if

((

subject

[ovector[1]] & 0xc0) != 0x80)

break

;

436

printf(

"Matching error %d\n"

, rc);

444

printf(

"\nMatch succeeded again at offset %d\n"

, (

int

)ovector[0]);

450

printf(

"ovector was not big enough for all the captured substrings\n"

);

456  if

(ovector[0] > ovector[1])

458

printf(

"\\K was used in an assertion to set the match start after its end.\n" 459  "From end to start the match was: %.*s\n"

, (

int

)(ovector[0] - ovector[1]),

460

(

char

*)(

subject

+ ovector[1]));

461

printf(

"Run abandoned\n"

);

470  for

(

i

= 0;

i

< rc;

i

++)

473  size_t

substring_length = ovector[2*

i

+1] - ovector[2*

i

];

474

printf(

"%2d: %.*s\n"

,

i

, (

int

)substring_length, (

char

*)substring_start);

477  if

(namecount == 0) printf(

"No named substrings\n"

);

else 480

printf(

"Named substrings\n"

);

481  for

(

i

= 0;

i

< namecount;

i

++)

483  int n

= (tabptr[0] << 8) | tabptr[1];

484

printf(

"(%d) %*s: %.*s\n"

,

n

, name_entry_size - 3, tabptr + 2,

485

(

int

)(ovector[2*

n

+1] - ovector[2*

n

]),

subject

+ ovector[2*

n

]);

486

tabptr += name_entry_size;

int strcmp(const char *str1, const char *str2)

#define PCRE2_ZERO_TERMINATED

#define PCRE2_NOTEMPTY_ATSTART

#define PCRE2_INFO_NAMETABLE

#define PCRE2_ERROR_NOMATCH

#define PCRE2_NEWLINE_ANYCRLF

#define PCRE2_INFO_ALLOPTIONS

#define PCRE2_INFO_NEWLINE

#define PCRE2_INFO_NAMECOUNT

#define PCRE2_NEWLINE_CRLF

#define PCRE2_NEWLINE_ANY

#define PCRE2_INFO_NAMEENTRYSIZE

PCRE2_EXPORT pcre2_code *PCRE2_CALL_CONVENTION pcre2_compile(PCRE2_SPTR pattern, PCRE2_SIZE patlen, uint32_t options, int *errorptr, PCRE2_SIZE *erroroffset, pcre2_compile_context *ccontext)

PCRE2_EXPORT void PCRE2_CALL_CONVENTION pcre2_code_free(pcre2_code *code)

PCRE2_EXPORT int PCRE2_CALL_CONVENTION pcre2_get_error_message(int enumber, PCRE2_UCHAR *buffer, PCRE2_SIZE size)

PCRE2_EXPORT int PCRE2_CALL_CONVENTION pcre2_match(const pcre2_code *code, PCRE2_SPTR subject, PCRE2_SIZE length, PCRE2_SIZE start_offset, uint32_t options, pcre2_match_data *match_data, pcre2_match_context *mcontext)

PCRE2_EXPORT pcre2_match_data *PCRE2_CALL_CONVENTION pcre2_match_data_create_from_pattern(const pcre2_code *code, pcre2_general_context *gcontext)

PCRE2_EXPORT PCRE2_SIZE *PCRE2_CALL_CONVENTION pcre2_get_ovector_pointer(pcre2_match_data *match_data)

PCRE2_EXPORT void PCRE2_CALL_CONVENTION pcre2_match_data_free(pcre2_match_data *match_data)

PCRE2_EXPORT PCRE2_SIZE PCRE2_CALL_CONVENTION pcre2_get_startchar(pcre2_match_data *match_data)

PCRE2_EXPORT int PCRE2_CALL_CONVENTION pcre2_pattern_info(const pcre2_code *code, uint32_t what, void *where)

int main(int argc, char **argv)

static pcre2_match_data * match_data


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4