Sortix cross-nightly manual
This manual documents Sortix cross-nightly. You can instead view this document in the latest official manual.
PCRECALLOUT(3) | Library Functions Manual | PCRECALLOUT(3) |
NAME
PCRE - Perl-compatible regular expressionsSYNOPSIS
#include <pcre.h>DESCRIPTION
PCRE provides a feature called "callout", which is a means of temporarily passing control to the caller of PCRE in the middle of pattern matching. The caller of PCRE provides an external function by putting its entry point in the global variable pcre_callout (pcre16_callout for the 16-bit library, pcre32_callout for the 32-bit library). By default, this variable contains NULL, which disables all calling out.(?C1)abc(?C2)def
A(\d{2}|--)
(?(?C9)(?=a)ab|de)
MISSING CALLOUTS
You should be aware that, because of optimizations in the way PCRE compiles and matches patterns, callouts sometimes do not happen exactly as you might expect.--->aaaa
+0 ^ ^
+1 ^ a+
+3 ^ ^ [bc]
No match
--->aaaa
+0 ^ ^
+1 ^ a+
+3 ^ ^ [bc]
+3 ^ ^ [bc]
+3 ^ ^ [bc]
+3 ^^ [bc]
No match
ab(?C4)cd
THE CALLOUT INTERFACE
During matching, when PCRE reaches a callout point, the external function defined by pcre_callout or pcre[16|32]_callout is called (if it is set). This applies to both normal and DFA matching. The only argument to the callout function is a pointer to a pcre_callout or pcre[16|32]_callout block. These structures contains the following fields:int version;
int callout_number;
int *offset_vector;
const char *subject; (8-bit version)
PCRE_SPTR16 subject; (16-bit version)
PCRE_SPTR32 subject; (32-bit version)
int subject_length;
int start_match;
int current_position;
int capture_top;
int capture_last;
void *callout_data;
int pattern_position;
int next_item_length;
const unsigned char *mark; (8-bit version)
const PCRE_UCHAR16 *mark; (16-bit version)
const PCRE_UCHAR32 *mark; (32-bit version)
RETURN VALUES
The external callout function returns an integer to PCRE. If the value is zero, matching proceeds as normal. If the value is greater than zero, matching fails at the current point, but the testing of other matching possibilities goes ahead, just as if a lookahead assertion had failed. If the value is less than zero, the match is abandoned, the matching function returns the negative value.12 November 2013 | PCRE 8.34 |