# pcre

- Manual
- Standard library
- Index

Search:
Group by:

# Types

    Pcre = object

  Source Edit

    Pcre16 = object

  Source Edit

    Pcre32 = object

  Source Edit

    JitStack = object

  Source Edit

    JitStack16 = object

  Source Edit

    JitStack32 = object

  Source Edit

    ExtraData = object
      flags*: clong                ## Bits for which fields are set
      study_data*: pointer         ## Opaque data from pcre_study()
      match_limit*: clong          ## Maximum number of calls to match()
      callout_data*: pointer       ## Data passed back in callouts
      tables*: pointer             ## Pointer to character tables
      match_limit_recursion*: clong ## Max recursive calls to match()
      mark*: pointer               ## For passing back a mark pointer
      executable_jit*: pointer     ## Contains a pointer to a compiled jit code

  Source Edit

    CalloutBlock = object
      version*: cint               ## Identifies version of block
      callout_number*: cint        ## Number compiled into pattern
      offset_vector*: ptr cint      ## The offset vector
      subject*: cstring            ## The subject being matched
      subject_length*: cint        ## The length of the subject
      start_match*: cint           ## Offset to start of this match attempt
      current_position*: cint      ## Where we currently are in the subject
      capture_top*: cint           ## Max current capture
      capture_last*: cint          ## Most recently closed capture
      callout_data*: pointer       ## Data passed in with the call
      pattern_position*: cint      ## Offset to next item in the pattern
      next_item_length*: cint      ## Length of next item in the pattern
      mark*: pointer               ## Pointer to current mark or NULL

  Source Edit

    JitCallback = proc (a: pointer): ptr JitStack {...}{.cdecl.}

  Source Edit

    PPcre {...}{.deprecated.} = ptr Pcre

  Source Edit

    PJitStack {...}{.deprecated.} = ptr JitStack

  Source Edit

# Consts

    PCRE_MAJOR = 8

  Source Edit

    PCRE_MINOR = 36

  Source Edit

    PCRE_PRERELEASE = true

  Source Edit

    PCRE_DATE = "2014-09-26"

  Source Edit

    CASELESS = 0x00000001

  Source Edit

    MULTILINE = 0x00000002

  Source Edit

    DOTALL = 0x00000004

  Source Edit

    EXTENDED = 0x00000008

  Source Edit

    ANCHORED = 0x00000010

  Source Edit

    DOLLAR_ENDONLY = 0x00000020

  Source Edit

    EXTRA = 0x00000040

  Source Edit

    NOTBOL = 0x00000080

  Source Edit

    NOTEOL = 0x00000100

  Source Edit

    UNGREEDY = 0x00000200

  Source Edit

    NOTEMPTY = 0x00000400

  Source Edit

    UTF8 = 0x00000800

  Source Edit

    UTF16 = 0x00000800

  Source Edit

    UTF32 = 0x00000800

  Source Edit

    NO_AUTO_CAPTURE = 0x00001000

  Source Edit

    NO_UTF8_CHECK = 0x00002000

  Source Edit

    NO_UTF16_CHECK = 0x00002000

  Source Edit

    NO_UTF32_CHECK = 0x00002000

  Source Edit

    AUTO_CALLOUT = 0x00004000

  Source Edit

    PARTIAL_SOFT = 0x00008000

  Source Edit

    PARTIAL = 0x00008000

  Source Edit

    NEVER_UTF = 0x00010000

  Source Edit

    DFA_SHORTEST = 0x00010000

  Source Edit

    NO_AUTO_POSSESS = 0x00020000

  Source Edit

    DFA_RESTART = 0x00020000

  Source Edit

    FIRSTLINE = 0x00040000

  Source Edit

    DUPNAMES = 0x00080000

  Source Edit

    NEWLINE_CR = 0x00100000

  Source Edit

    NEWLINE_LF = 0x00200000

  Source Edit

    NEWLINE_CRLF = 0x00300000

  Source Edit

    NEWLINE_ANY = 0x00400000

  Source Edit

    NEWLINE_ANYCRLF = 0x00500000

  Source Edit

    BSR_ANYCRLF = 0x00800000

  Source Edit

    BSR_UNICODE = 0x01000000

  Source Edit

    JAVASCRIPT_COMPAT = 0x02000000

  Source Edit

    NO_START_OPTIMIZE = 0x04000000

  Source Edit

    NO_START_OPTIMISE = 0x04000000

  Source Edit

    PARTIAL_HARD = 0x08000000

  Source Edit

    NOTEMPTY_ATSTART = 0x10000000

  Source Edit

    UCP = 0x20000000

  Source Edit

    ERROR_NOMATCH = -1

  Source Edit

    ERROR_NULL = -2

  Source Edit

    ERROR_BADOPTION = -3

  Source Edit

    ERROR_BADMAGIC = -4

  Source Edit

    ERROR_UNKNOWN_OPCODE = -5

  Source Edit

    ERROR_UNKNOWN_NODE = -5

  For backward compatibility Source Edit

    ERROR_NOMEMORY = -6

  Source Edit

    ERROR_NOSUBSTRING = -7

  Source Edit

    ERROR_MATCHLIMIT = -8

  Source Edit

    ERROR_CALLOUT = -9

  Never used by PCRE itself Source Edit

    ERROR_BADUTF8 = -10

  Same for 8/16/32 Source Edit

    ERROR_BADUTF16 = -10

  Same for 8/16/32 Source Edit

    ERROR_BADUTF32 = -10

  Same for 8/16/32 Source Edit

    ERROR_BADUTF8_OFFSET = -11

  Same for 8/16 Source Edit

    ERROR_BADUTF16_OFFSET = -11

  Same for 8/16 Source Edit

    ERROR_PARTIAL = -12

  Source Edit

    ERROR_BADPARTIAL = -13

  Source Edit

    ERROR_INTERNAL = -14

  Source Edit

    ERROR_BADCOUNT = -15

  Source Edit

    ERROR_DFA_UITEM = -16

  Source Edit

    ERROR_DFA_UCOND = -17

  Source Edit

    ERROR_DFA_UMLIMIT = -18

  Source Edit

    ERROR_DFA_WSSIZE = -19

  Source Edit

    ERROR_DFA_RECURSE = -20

  Source Edit

    ERROR_RECURSIONLIMIT = -21

  Source Edit

    ERROR_NULLWSLIMIT = -22

  No longer actually used Source Edit

    ERROR_BADNEWLINE = -23

  Source Edit

    ERROR_BADOFFSET = -24

  Source Edit

    ERROR_SHORTUTF8 = -25

  Source Edit

    ERROR_SHORTUTF16 = -25

  Same for 8/16 Source Edit

    ERROR_RECURSELOOP = -26

  Source Edit

    ERROR_JIT_STACKLIMIT = -27

  Source Edit

    ERROR_BADMODE = -28

  Source Edit

    ERROR_BADENDIANNESS = -29

  Source Edit

    ERROR_DFA_BADRESTART = -30

  Source Edit

    ERROR_JIT_BADOPTION = -31

  Source Edit

    ERROR_BADLENGTH = -32

  Source Edit

    ERROR_UNSET = -33

  Source Edit

    UTF8_ERR0 = 0

  Source Edit

    UTF8_ERR1 = 1

  Source Edit

    UTF8_ERR2 = 2

  Source Edit

    UTF8_ERR3 = 3

  Source Edit

    UTF8_ERR4 = 4

  Source Edit

    UTF8_ERR5 = 5

  Source Edit

    UTF8_ERR6 = 6

  Source Edit

    UTF8_ERR7 = 7

  Source Edit

    UTF8_ERR8 = 8

  Source Edit

    UTF8_ERR9 = 9

  Source Edit

    UTF8_ERR10 = 10

  Source Edit

    UTF8_ERR11 = 11

  Source Edit

    UTF8_ERR12 = 12

  Source Edit

    UTF8_ERR13 = 13

  Source Edit

    UTF8_ERR14 = 14

  Source Edit

    UTF8_ERR15 = 15

  Source Edit

    UTF8_ERR16 = 16

  Source Edit

    UTF8_ERR17 = 17

  Source Edit

    UTF8_ERR18 = 18

  Source Edit

    UTF8_ERR19 = 19

  Source Edit

    UTF8_ERR20 = 20

  Source Edit

    UTF8_ERR21 = 21

  Source Edit

    UTF8_ERR22 = 22

  Source Edit

    UTF16_ERR0 = 0

  Source Edit

    UTF16_ERR1 = 1

  Source Edit

    UTF16_ERR2 = 2

  Source Edit

    UTF16_ERR3 = 3

  Source Edit

    UTF16_ERR4 = 4

  Source Edit

    UTF32_ERR0 = 0

  Source Edit

    UTF32_ERR1 = 1

  Source Edit

    UTF32_ERR2 = 2

  Source Edit

    UTF32_ERR3 = 3

  Source Edit

    INFO_OPTIONS = 0

  Source Edit

    INFO_SIZE = 1

  Source Edit

    INFO_CAPTURECOUNT = 2

  Source Edit

    INFO_BACKREFMAX = 3

  Source Edit

    INFO_FIRSTBYTE = 4

  Source Edit

    INFO_FIRSTCHAR = 4

  For backwards compatibility Source Edit

    INFO_FIRSTTABLE = 5

  Source Edit

    INFO_LASTLITERAL = 6

  Source Edit

    INFO_NAMEENTRYSIZE = 7

  Source Edit

    INFO_NAMECOUNT = 8

  Source Edit

    INFO_NAMETABLE = 9

  Source Edit

    INFO_STUDYSIZE = 10

  Source Edit

    INFO_DEFAULT_TABLES = 11

  Source Edit

    INFO_OKPARTIAL = 12

  Source Edit

    INFO_JCHANGED = 13

  Source Edit

    INFO_HASCRORLF = 14

  Source Edit

    INFO_MINLENGTH = 15

  Source Edit

    INFO_JIT = 16

  Source Edit

    INFO_JITSIZE = 17

  Source Edit

    INFO_MAXLOOKBEHIND = 18

  Source Edit

    INFO_FIRSTCHARACTER = 19

  Source Edit

    INFO_FIRSTCHARACTERFLAGS = 20

  Source Edit

    INFO_REQUIREDCHAR = 21

  Source Edit

    INFO_REQUIREDCHARFLAGS = 22

  Source Edit

    INFO_MATCHLIMIT = 23

  Source Edit

    INFO_RECURSIONLIMIT = 24

  Source Edit

    INFO_MATCH_EMPTY = 25

  Source Edit

    CONFIG_UTF8 = 0

  Source Edit

    CONFIG_NEWLINE = 1

  Source Edit

    CONFIG_LINK_SIZE = 2

  Source Edit

    CONFIG_POSIX_MALLOC_THRESHOLD = 3

  Source Edit

    CONFIG_MATCH_LIMIT = 4

  Source Edit

    CONFIG_STACKRECURSE = 5

  Source Edit

    CONFIG_UNICODE_PROPERTIES = 6

  Source Edit

    CONFIG_MATCH_LIMIT_RECURSION = 7

  Source Edit

    CONFIG_BSR = 8

  Source Edit

    CONFIG_JIT = 9

  Source Edit

    CONFIG_UTF16 = 10

  Source Edit

    CONFIG_JITTARGET = 11

  Source Edit

    CONFIG_UTF32 = 12

  Source Edit

    CONFIG_PARENS_LIMIT = 13

  Source Edit

    STUDY_JIT_COMPILE = 0x00000001

  Source Edit

    STUDY_JIT_PARTIAL_SOFT_COMPILE = 0x00000002

  Source Edit

    STUDY_JIT_PARTIAL_HARD_COMPILE = 0x00000004

  Source Edit

    STUDY_EXTRA_NEEDED = 0x00000008

  Source Edit

    EXTRA_STUDY_DATA = 0x00000001

  Source Edit

    EXTRA_MATCH_LIMIT = 0x00000002

  Source Edit

    EXTRA_CALLOUT_DATA = 0x00000004

  Source Edit

    EXTRA_TABLES = 0x00000008

  Source Edit

    EXTRA_MATCH_LIMIT_RECURSION = 0x00000010

  Source Edit

    EXTRA_MARK = 0x00000020

  Source Edit

    EXTRA_EXECUTABLE_JIT = 0x00000040

  Source Edit

# Procs

    proc compile(pattern: cstring; options: cint; errptr: ptr cstring; erroffset: ptr cint;
                tableptr: pointer): ptr Pcre {...}{.cdecl, importc: "pcre_$1".}

  Source Edit

    proc compile2(pattern: cstring; options: cint; errorcodeptr: ptr cint;
                 errptr: ptr cstring; erroffset: ptr cint; tableptr: pointer): ptr Pcre {...}{.
        cdecl, importc: "pcre_$1".}

  Source Edit

    proc config(what: cint; where: pointer): cint {...}{.cdecl, importc: "pcre_$1".}

  Source Edit

    proc copy_named_substring(code: ptr Pcre; subject: cstring; ovector: ptr cint;
                             stringcount: cint; stringname: cstring; buffer: cstring;
                             buffersize: cint): cint {...}{.cdecl, importc: "pcre_$1".}

  Source Edit

    proc copy_substring(subject: cstring; ovector: ptr cint; stringcount: cint;
                       stringnumber: cint; buffer: cstring; buffersize: cint): cint {...}{.
        cdecl, importc: "pcre_$1".}

  Source Edit

    proc dfa_exec(code: ptr Pcre; extra: ptr ExtraData; subject: cstring; length: cint;
                 startoffset: cint; options: cint; ovector: ptr cint; ovecsize: cint;
                 workspace: ptr cint; wscount: cint): cint {...}{.cdecl, importc: "pcre_$1".}

  Source Edit

    proc exec(code: ptr Pcre; extra: ptr ExtraData; subject: cstring; length: cint;
             startoffset: cint; options: cint; ovector: ptr cint; ovecsize: cint): cint {...}{.
        cdecl, importc: "pcre_$1".}

  Source Edit

    proc jit_exec(code: ptr Pcre; extra: ptr ExtraData; subject: cstring; length: cint;
                 startoffset: cint; options: cint; ovector: ptr cint; ovecsize: cint;
                 jstack: ptr JitStack): cint {...}{.cdecl, importc: "pcre_$1".}

  Source Edit

    proc free_substring(stringptr: cstring) {...}{.cdecl, importc: "pcre_$1".}

  Source Edit

    proc free_substring_list(stringptr: cstringArray) {...}{.cdecl, importc: "pcre_$1".}

  Source Edit

    proc fullinfo(code: ptr Pcre; extra: ptr ExtraData; what: cint; where: pointer): cint {...}{.
        cdecl, importc: "pcre_$1".}

  Source Edit

    proc get_named_substring(code: ptr Pcre; subject: cstring; ovector: ptr cint;
                            stringcount: cint; stringname: cstring;
                            stringptr: cstringArray): cint {...}{.cdecl, importc: "pcre_$1".}

  Source Edit

    proc get_stringnumber(code: ptr Pcre; name: cstring): cint {...}{.cdecl, importc: "pcre_$1".}

  Source Edit

    proc get_stringtable_entries(code: ptr Pcre; name: cstring; first: cstringArray;
                                last: cstringArray): cint {...}{.cdecl, importc: "pcre_$1".}

  Source Edit

    proc get_substring(subject: cstring; ovector: ptr cint; stringcount: cint;
                      stringnumber: cint; stringptr: cstringArray): cint {...}{.cdecl,
        importc: "pcre_$1".}

  Source Edit

    proc get_substring_list(subject: cstring; ovector: ptr cint; stringcount: cint;
                           listptr: ptr cstringArray): cint {...}{.cdecl, importc: "pcre_$1".}

  Source Edit

    proc maketables(): pointer {...}{.cdecl, importc: "pcre_$1".}

  Source Edit

    proc refcount(code: ptr Pcre; adjust: cint): cint {...}{.cdecl, importc: "pcre_$1".}

  Source Edit

    proc study(code: ptr Pcre; options: cint; errptr: ptr cstring): ptr ExtraData {...}{.cdecl,
        importc: "pcre_$1".}

  Source Edit

    proc free_study(extra: ptr ExtraData) {...}{.cdecl, importc: "pcre_$1".}

  Source Edit

    proc version(): cstring {...}{.cdecl, importc: "pcre_$1".}

  Source Edit

    proc pattern_to_host_byte_order(code: ptr Pcre; extra: ptr ExtraData; tables: pointer): cint {...}{.
        cdecl, importc: "pcre_$1".}

  Source Edit

    proc jit_stack_alloc(startsize: cint; maxsize: cint): ptr JitStack {...}{.cdecl,
        importc: "pcre_$1".}

  Source Edit

    proc jit_stack_free(stack: ptr JitStack) {...}{.cdecl, importc: "pcre_$1".}

  Source Edit

    proc assign_jit_stack(extra: ptr ExtraData; callback: JitCallback; data: pointer) {...}{.
        cdecl, importc: "pcre_$1".}

  Source Edit

    proc jit_free_unused_memory() {...}{.cdecl, importc: "pcre_$1".}

  Source Edit

    proc study(code: ptr Pcre; options: cint; errptr: var cstring): ptr ExtraData {...}{.deprecated,
        cdecl, importc: "pcre_$1".}

  Deprecated
  Source Edit