Safe Haskell | None |
---|---|
Language | Haskell2010 |
- Types
- The general context
- The compile context
- The match context
- Checking build-time options
- Compiling a pattern
- JIT compilation
- Locale support
- Information about a compiled pattern
- Callouts
- The match data block
- Matching a pattern
- DFA matching
- Returned string and captured substrings
- Creating a new string with substitutions
- Other information about a match
- Obtaining a textual error message
- Pattern serialization
A complete binding to the low-level C API.
Items here are named identically to their C counterparts. Therefore, documentation will be sparse; the official PCRE2 API docs should suffice.
Synopsis
- type PCRE2_UCHAR = CUChar
- type PCRE2_SPTR = Ptr PCRE2_UCHAR
- type PCRE2_SIZE = CSize
- data Pcre2_general_context
- data Pcre2_compile_context
- data Pcre2_match_context
- data Pcre2_callout_block
- data Pcre2_substitute_callout_block
- data Pcre2_code
- data Pcre2_jit_stack
- data Pcre2_match_data
- data Pcre2_callout_enumerate_block
- pcre2_general_context_create :: FunPtr (PCRE2_SIZE -> Ptr a -> IO (Ptr b)) -> FunPtr (Ptr b -> Ptr a -> IO ()) -> Ptr a -> IO (Ptr Pcre2_general_context)
- pcre2_general_context_copy :: Ptr Pcre2_general_context -> IO (Ptr Pcre2_general_context)
- pcre2_general_context_free :: Ptr Pcre2_general_context -> IO ()
- pcre2_compile_context_create :: Ptr Pcre2_general_context -> IO (Ptr Pcre2_compile_context)
- pcre2_compile_context_copy :: Ptr Pcre2_compile_context -> IO (Ptr Pcre2_compile_context)
- pcre2_compile_context_free :: Ptr Pcre2_compile_context -> IO ()
- pcre2_ERROR_BADDATA :: CInt
- pcre2_set_bsr :: Ptr Pcre2_compile_context -> CUInt -> IO CInt
- pcre2_BSR_ANYCRLF :: CUInt
- pcre2_BSR_UNICODE :: CUInt
- pcre2_set_character_tables :: Ptr Pcre2_compile_context -> Ptr CUChar -> IO CInt
- pcre2_set_compile_extra_options :: Ptr Pcre2_compile_context -> CUInt -> IO CInt
- pcre2_set_max_pattern_length :: Ptr Pcre2_compile_context -> PCRE2_SIZE -> IO CInt
- pcre2_set_newline :: Ptr Pcre2_compile_context -> CUInt -> IO CInt
- pcre2_NEWLINE_CR :: CUInt
- pcre2_NEWLINE_LF :: CUInt
- pcre2_NEWLINE_CRLF :: CUInt
- pcre2_NEWLINE_ANY :: CUInt
- pcre2_NEWLINE_ANYCRLF :: CUInt
- pcre2_NEWLINE_NUL :: CUInt
- pcre2_set_parens_nest_limit :: Ptr Pcre2_compile_context -> CUInt -> IO CInt
- pcre2_set_compile_recursion_guard :: Ptr Pcre2_compile_context -> FunPtr (CUInt -> Ptr a -> IO CInt) -> Ptr a -> IO CInt
- pcre2_match_context_create :: Ptr Pcre2_general_context -> IO (Ptr Pcre2_match_context)
- pcre2_match_context_copy :: Ptr Pcre2_match_context -> IO (Ptr Pcre2_match_context)
- pcre2_match_context_free :: Ptr Pcre2_match_context -> IO ()
- pcre2_set_callout :: Ptr Pcre2_match_context -> FunPtr (Ptr Pcre2_callout_block -> Ptr a -> IO CInt) -> Ptr a -> IO CInt
- pcre2_set_substitute_callout :: Ptr Pcre2_match_context -> FunPtr (Ptr Pcre2_substitute_callout_block -> Ptr a -> IO CInt) -> Ptr a -> IO CInt
- pcre2_set_offset_limit :: Ptr Pcre2_match_context -> PCRE2_SIZE -> IO CInt
- pcre2_UNSET :: PCRE2_SIZE
- pcre2_set_heap_limit :: Ptr Pcre2_match_context -> CUInt -> IO CInt
- pcre2_set_match_limit :: Ptr Pcre2_match_context -> CUInt -> IO CInt
- pcre2_set_depth_limit :: Ptr Pcre2_match_context -> CUInt -> IO CInt
- pcre2_config :: CUInt -> Ptr a -> IO CInt
- pcre2_CONFIG_BSR :: CUInt
- pcre2_CONFIG_COMPILED_WIDTHS :: CUInt
- pcre2_CONFIG_DEPTHLIMIT :: CUInt
- pcre2_CONFIG_HEAPLIMIT :: CUInt
- pcre2_CONFIG_JIT :: CUInt
- pcre2_CONFIG_JITTARGET :: CUInt
- pcre2_CONFIG_LINKSIZE :: CUInt
- pcre2_CONFIG_MATCHLIMIT :: CUInt
- pcre2_CONFIG_NEWLINE :: CUInt
- pcre2_CONFIG_NEVER_BACKSLASH_C :: CUInt
- pcre2_CONFIG_PARENSLIMIT :: CUInt
- pcre2_CONFIG_STACKRECURSE :: CUInt
- pcre2_CONFIG_TABLES_LENGTH :: CUInt
- pcre2_CONFIG_UNICODE_VERSION :: CUInt
- pcre2_CONFIG_UNICODE :: CUInt
- pcre2_CONFIG_VERSION :: CUInt
- pcre2_compile :: PCRE2_SPTR -> PCRE2_SIZE -> CUInt -> Ptr CInt -> Ptr PCRE2_SIZE -> Ptr Pcre2_compile_context -> IO (Ptr Pcre2_code)
- pcre2_ZERO_TERMINATED :: PCRE2_SIZE
- pcre2_code_free :: Ptr Pcre2_code -> IO ()
- pcre2_code_copy :: Ptr Pcre2_code -> IO (Ptr Pcre2_code)
- pcre2_code_copy_with_tables :: Ptr Pcre2_code -> IO (Ptr Pcre2_code)
- pcre2_ANCHORED :: CUInt
- pcre2_ALLOW_EMPTY_CLASS :: CUInt
- pcre2_ALT_BSUX :: CUInt
- pcre2_ALT_CIRCUMFLEX :: CUInt
- pcre2_ALT_VERBNAMES :: CUInt
- pcre2_AUTO_CALLOUT :: CUInt
- pcre2_CASELESS :: CUInt
- pcre2_DOLLAR_ENDONLY :: CUInt
- pcre2_DOTALL :: CUInt
- pcre2_DUPNAMES :: CUInt
- pcre2_ENDANCHORED :: CUInt
- pcre2_EXTENDED :: CUInt
- pcre2_EXTENDED_MORE :: CUInt
- pcre2_FIRSTLINE :: CUInt
- pcre2_LITERAL :: CUInt
- pcre2_MATCH_INVALID_UTF :: CUInt
- pcre2_MATCH_UNSET_BACKREF :: CUInt
- pcre2_MULTILINE :: CUInt
- pcre2_NEVER_BACKSLASH_C :: CUInt
- pcre2_NEVER_UCP :: CUInt
- pcre2_NEVER_UTF :: CUInt
- pcre2_NO_AUTO_CAPTURE :: CUInt
- pcre2_NO_AUTO_POSSESS :: CUInt
- pcre2_NO_DOTSTAR_ANCHOR :: CUInt
- pcre2_NO_START_OPTIMIZE :: CUInt
- pcre2_NO_UTF_CHECK :: CUInt
- pcre2_UCP :: CUInt
- pcre2_UNGREEDY :: CUInt
- pcre2_USE_OFFSET_LIMIT :: CUInt
- pcre2_UTF :: CUInt
- pcre2_EXTRA_ALLOW_SURROGATE_ESCAPES :: CUInt
- pcre2_EXTRA_ALT_BSUX :: CUInt
- pcre2_EXTRA_BAD_ESCAPE_IS_LITERAL :: CUInt
- pcre2_EXTRA_ESCAPED_CR_IS_LF :: CUInt
- pcre2_EXTRA_MATCH_LINE :: CUInt
- pcre2_EXTRA_MATCH_WORD :: CUInt
- pcre2_jit_compile :: Ptr Pcre2_code -> CUInt -> IO CInt
- pcre2_JIT_COMPLETE :: CUInt
- pcre2_JIT_PARTIAL_HARD :: CUInt
- pcre2_JIT_PARTIAL_SOFT :: CUInt
- pcre2_ERROR_JIT_BADOPTION :: CInt
- pcre2_jit_match :: Ptr Pcre2_code -> PCRE2_SPTR -> PCRE2_SIZE -> PCRE2_SIZE -> CUInt -> Ptr Pcre2_match_data -> Ptr Pcre2_match_context -> IO CInt
- pcre2_jit_free_unused_memory :: Ptr Pcre2_general_context -> IO ()
- pcre2_jit_stack_create :: PCRE2_SIZE -> PCRE2_SIZE -> Ptr Pcre2_general_context -> IO (Ptr Pcre2_jit_stack)
- pcre2_jit_stack_assign :: Ptr Pcre2_match_context -> FunPtr (Ptr a -> IO (Ptr Pcre2_jit_stack)) -> Ptr a -> IO ()
- pcre2_jit_stack_free :: Ptr Pcre2_jit_stack -> IO ()
- pcre2_maketables :: Ptr Pcre2_general_context -> IO (Ptr CUChar)
- pcre2_maketables_free :: Ptr Pcre2_general_context -> Ptr CUChar -> IO ()
- pcre2_pattern_info :: Ptr Pcre2_code -> CUInt -> Ptr a -> IO CInt
- pcre2_INFO_ALLOPTIONS :: CUInt
- pcre2_INFO_ARGOPTIONS :: CUInt
- pcre2_INFO_EXTRAOPTIONS :: CUInt
- pcre2_INFO_BACKREFMAX :: CUInt
- pcre2_INFO_BSR :: CUInt
- pcre2_INFO_CAPTURECOUNT :: CUInt
- pcre2_INFO_DEPTHLIMIT :: CUInt
- pcre2_INFO_FIRSTBITMAP :: CUInt
- pcre2_INFO_FIRSTCODETYPE :: CUInt
- pcre2_INFO_FIRSTCODEUNIT :: CUInt
- pcre2_INFO_FRAMESIZE :: CUInt
- pcre2_INFO_HASBACKSLASHC :: CUInt
- pcre2_INFO_HASCRORLF :: CUInt
- pcre2_INFO_HEAPLIMIT :: CUInt
- pcre2_INFO_JCHANGED :: CUInt
- pcre2_INFO_JITSIZE :: CUInt
- pcre2_INFO_LASTCODETYPE :: CUInt
- pcre2_INFO_LASTCODEUNIT :: CUInt
- pcre2_INFO_MATCHEMPTY :: CUInt
- pcre2_INFO_MATCHLIMIT :: CUInt
- pcre2_INFO_MAXLOOKBEHIND :: CUInt
- pcre2_INFO_MINLENGTH :: CUInt
- pcre2_INFO_NAMECOUNT :: CUInt
- pcre2_INFO_NAMEENTRYSIZE :: CUInt
- pcre2_INFO_NAMETABLE :: CUInt
- pcre2_INFO_NEWLINE :: CUInt
- pcre2_INFO_SIZE :: CUInt
- pcre2_ERROR_UNSET :: CInt
- pcre2_substring_nametable_scan :: Ptr Pcre2_code -> PCRE2_SPTR -> Ptr PCRE2_SPTR -> Ptr PCRE2_SPTR -> IO CInt
- pcre2_callout_enumerate :: Ptr Pcre2_code -> FunPtr (Ptr Pcre2_callout_enumerate_block -> Ptr a -> IO CInt) -> Ptr a -> IO CInt
- pcre2_callout_block_version :: Ptr Pcre2_callout_block -> IO CUInt
- pcre2_callout_block_callout_number :: Ptr Pcre2_callout_block -> IO CUInt
- pcre2_callout_block_capture_top :: Ptr Pcre2_callout_block -> IO CUInt
- pcre2_callout_block_capture_last :: Ptr Pcre2_callout_block -> IO CUInt
- pcre2_callout_block_callout_flags :: Ptr Pcre2_callout_block -> IO CUInt
- pcre2_CALLOUT_STARTMATCH :: CUInt
- pcre2_CALLOUT_BACKTRACK :: CUInt
- pcre2_callout_block_offset_vector :: Ptr Pcre2_callout_block -> IO (Ptr PCRE2_SIZE)
- pcre2_callout_block_mark :: Ptr Pcre2_callout_block -> IO PCRE2_SPTR
- pcre2_callout_block_subject :: Ptr Pcre2_callout_block -> IO PCRE2_SPTR
- pcre2_callout_block_subject_length :: Ptr Pcre2_callout_block -> IO PCRE2_SIZE
- pcre2_callout_block_start_match :: Ptr Pcre2_callout_block -> IO PCRE2_SIZE
- pcre2_callout_block_current_position :: Ptr Pcre2_callout_block -> IO PCRE2_SIZE
- pcre2_callout_block_pattern_position :: Ptr Pcre2_callout_block -> IO PCRE2_SIZE
- pcre2_callout_block_next_item_length :: Ptr Pcre2_callout_block -> IO PCRE2_SIZE
- pcre2_callout_block_callout_string_offset :: Ptr Pcre2_callout_block -> IO PCRE2_SIZE
- pcre2_callout_block_callout_string_length :: Ptr Pcre2_callout_block -> IO PCRE2_SIZE
- pcre2_callout_block_callout_string :: Ptr Pcre2_callout_block -> IO PCRE2_SPTR
- pcre2_callout_enumerate_block_version :: Ptr Pcre2_callout_enumerate_block -> IO CUInt
- pcre2_callout_enumerate_block_pattern_position :: Ptr Pcre2_callout_enumerate_block -> IO PCRE2_SIZE
- pcre2_callout_enumerate_block_next_item_length :: Ptr Pcre2_callout_enumerate_block -> IO PCRE2_SIZE
- pcre2_callout_enumerate_block_callout_number :: Ptr Pcre2_callout_enumerate_block -> IO CUInt
- pcre2_callout_enumerate_block_callout_string_offset :: Ptr Pcre2_callout_enumerate_block -> IO PCRE2_SIZE
- pcre2_callout_enumerate_block_callout_string_length :: Ptr Pcre2_callout_enumerate_block -> IO PCRE2_SIZE
- pcre2_callout_enumerate_block_callout_string :: Ptr Pcre2_callout_enumerate_block -> IO PCRE2_SPTR
- pcre2_substitute_callout_block_version :: Ptr Pcre2_substitute_callout_block -> IO CUInt
- pcre2_substitute_callout_block_subscount :: Ptr Pcre2_substitute_callout_block -> IO CUInt
- pcre2_substitute_callout_block_input :: Ptr Pcre2_substitute_callout_block -> IO PCRE2_SPTR
- pcre2_substitute_callout_block_output :: Ptr Pcre2_substitute_callout_block -> IO PCRE2_SPTR
- pcre2_substitute_callout_block_ovector :: Ptr Pcre2_substitute_callout_block -> IO (Ptr PCRE2_SIZE)
- pcre2_substitute_callout_block_oveccount :: Ptr Pcre2_substitute_callout_block -> IO CUInt
- pcre2_substitute_callout_block_output_offsets :: Ptr Pcre2_substitute_callout_block -> IO (Ptr PCRE2_SIZE)
- pcre2_match_data_create :: CUInt -> Ptr Pcre2_general_context -> IO (Ptr Pcre2_match_data)
- pcre2_match_data_create_from_pattern :: Ptr Pcre2_code -> Ptr Pcre2_general_context -> IO (Ptr Pcre2_match_data)
- pcre2_match_data_free :: Ptr Pcre2_match_data -> IO ()
- pcre2_match :: Ptr Pcre2_code -> PCRE2_SPTR -> PCRE2_SIZE -> PCRE2_SIZE -> CUInt -> Ptr Pcre2_match_data -> Ptr Pcre2_match_context -> IO CInt
- pcre2_COPY_MATCHED_SUBJECT :: CUInt
- pcre2_NOTBOL :: CUInt
- pcre2_NOTEOL :: CUInt
- pcre2_NOTEMPTY :: CUInt
- pcre2_NOTEMPTY_ATSTART :: CUInt
- pcre2_NO_JIT :: CUInt
- pcre2_PARTIAL_HARD :: CUInt
- pcre2_PARTIAL_SOFT :: CUInt
- pcre2_ERROR_NOMATCH :: CInt
- pcre2_ERROR_PARTIAL :: CInt
- pcre2_ERROR_BADMAGIC :: CInt
- pcre2_ERROR_BADMODE :: CInt
- pcre2_ERROR_BADOFFSET :: CInt
- pcre2_ERROR_BADOPTION :: CInt
- pcre2_ERROR_BADUTFOFFSET :: CInt
- pcre2_ERROR_CALLOUT :: CInt
- pcre2_ERROR_DEPTHLIMIT :: CInt
- pcre2_ERROR_HEAPLIMIT :: CInt
- pcre2_ERROR_INTERNAL :: CInt
- pcre2_ERROR_JIT_STACKLIMIT :: CInt
- pcre2_ERROR_MATCHLIMIT :: CInt
- pcre2_ERROR_NOMEMORY :: CInt
- pcre2_ERROR_NULL :: CInt
- pcre2_ERROR_UTF16_ERR1 :: CInt
- pcre2_ERROR_UTF16_ERR2 :: CInt
- pcre2_ERROR_UTF16_ERR3 :: CInt
- pcre2_dfa_match :: Ptr Pcre2_code -> PCRE2_SPTR -> PCRE2_SIZE -> PCRE2_SIZE -> CUInt -> Ptr Pcre2_match_data -> Ptr Pcre2_match_context -> Ptr CInt -> PCRE2_SIZE -> IO CInt
- pcre2_DFA_SHORTEST :: CUInt
- pcre2_DFA_RESTART :: CUInt
- pcre2_ERROR_DFA_UFUNC :: CInt
- pcre2_ERROR_DFA_UITEM :: CInt
- pcre2_ERROR_DFA_UCOND :: CInt
- pcre2_ERROR_DFA_UINVALID_UTF :: CInt
- pcre2_ERROR_DFA_WSSIZE :: CInt
- pcre2_ERROR_DFA_RECURSE :: CInt
- pcre2_ERROR_DFA_BADRESTART :: CInt
- pcre2_get_ovector_count :: Ptr Pcre2_match_data -> IO CUInt
- pcre2_get_ovector_pointer :: Ptr Pcre2_match_data -> IO (Ptr PCRE2_SIZE)
- pcre2_substring_length_bynumber :: Ptr Pcre2_match_data -> CUInt -> Ptr PCRE2_SIZE -> IO CInt
- pcre2_substring_copy_bynumber :: Ptr Pcre2_match_data -> CUInt -> Ptr PCRE2_UCHAR -> Ptr PCRE2_SIZE -> IO CInt
- pcre2_substring_get_bynumber :: Ptr Pcre2_match_data -> CUInt -> Ptr (Ptr PCRE2_UCHAR) -> Ptr PCRE2_SIZE -> IO CInt
- pcre2_substring_list_get :: Ptr Pcre2_match_data -> Ptr (Ptr (Ptr PCRE2_UCHAR)) -> Ptr (Ptr PCRE2_SIZE) -> IO CInt
- pcre2_substring_list_free :: Ptr PCRE2_SPTR -> IO ()
- pcre2_substring_number_from_name :: Ptr Pcre2_code -> PCRE2_SPTR -> IO CInt
- pcre2_substring_length_byname :: Ptr Pcre2_match_data -> PCRE2_SPTR -> Ptr PCRE2_SIZE -> IO CInt
- pcre2_substring_copy_byname :: Ptr Pcre2_match_data -> PCRE2_SPTR -> Ptr PCRE2_UCHAR -> Ptr PCRE2_SIZE -> IO CInt
- pcre2_substring_get_byname :: Ptr Pcre2_match_data -> PCRE2_SPTR -> Ptr (Ptr PCRE2_UCHAR) -> Ptr PCRE2_SIZE -> IO CInt
- pcre2_substring_free :: Ptr PCRE2_UCHAR -> IO ()
- pcre2_ERROR_NOSUBSTRING :: CInt
- pcre2_ERROR_NOUNIQUESUBSTRING :: CInt
- pcre2_ERROR_UNAVAILABLE :: CInt
- pcre2_substitute :: Ptr Pcre2_code -> PCRE2_SPTR -> PCRE2_SIZE -> PCRE2_SIZE -> CUInt -> Ptr Pcre2_match_data -> Ptr Pcre2_match_context -> PCRE2_SPTR -> PCRE2_SIZE -> Ptr PCRE2_UCHAR -> Ptr PCRE2_SIZE -> IO CInt
- pcre2_SUBSTITUTE_REPLACEMENT_ONLY :: CUInt
- pcre2_SUBSTITUTE_GLOBAL :: CUInt
- pcre2_SUBSTITUTE_MATCHED :: CUInt
- pcre2_SUBSTITUTE_OVERFLOW_LENGTH :: CUInt
- pcre2_SUBSTITUTE_LITERAL :: CUInt
- pcre2_SUBSTITUTE_UNKNOWN_UNSET :: CUInt
- pcre2_SUBSTITUTE_UNSET_EMPTY :: CUInt
- pcre2_SUBSTITUTE_EXTENDED :: CUInt
- pcre2_ERROR_BADREPLACEMENT :: CInt
- pcre2_ERROR_BADREPESCAPE :: CInt
- pcre2_ERROR_BADSUBSTITUTION :: CInt
- pcre2_ERROR_BADSUBSPATTERN :: CInt
- pcre2_get_mark :: Ptr Pcre2_match_data -> IO PCRE2_SPTR
- pcre2_get_startchar :: Ptr Pcre2_match_data -> IO PCRE2_SIZE
- pcre2_get_error_message :: CInt -> Ptr PCRE2_UCHAR -> PCRE2_SIZE -> IO CInt
- pcre2_serialize_decode :: Ptr (Ptr Pcre2_code) -> CInt -> Ptr CUInt -> Ptr Pcre2_general_context -> IO CInt
- pcre2_serialize_encode :: Ptr (Ptr Pcre2_code) -> CInt -> Ptr (Ptr CUInt) -> Ptr PCRE2_SIZE -> Ptr Pcre2_general_context -> IO CInt
- pcre2_serialize_free :: Ptr CUChar -> IO ()
- pcre2_serialize_get_number_of_codes :: Ptr CUChar -> IO CInt
- pcre2_ERROR_BADSERIALIZEDDATA :: CInt
- pcre2_ERROR_MIXEDTABLES :: CInt
Types
type PCRE2_UCHAR = CUChar Source #
"The UCHAR
types define unsigned code units of the appropriate widths.
For example, PCRE2_UCHAR16
is usually defined as uint16_t
."
type PCRE2_SPTR = Ptr PCRE2_UCHAR Source #
"The SPTR
types are constant pointers to the equivalent UCHAR
types,
that is, they are pointers to vectors of unsigned code units."
type PCRE2_SIZE = CSize Source #
"...string lengths and offsets into strings of code units...are always of
type PCRE2_SIZE
...currently always defined as size_t
."
Opaque types
These correspond to structs that are only ever passed by reference. They simply exist for type safety and cannot be constructed in Haskell.
data Pcre2_general_context Source #
data Pcre2_compile_context Source #
data Pcre2_match_context Source #
data Pcre2_callout_block Source #
data Pcre2_code Source #
data Pcre2_jit_stack Source #
data Pcre2_match_data Source #
The general context
The compile context
pcre2_compile_context_create :: Ptr Pcre2_general_context -> IO (Ptr Pcre2_compile_context) Source #
Compile context setters
:: Ptr Pcre2_compile_context | |
-> CUInt | See below for possible values. |
-> IO CInt |
pcre2_set_compile_extra_options Source #
:: Ptr Pcre2_compile_context | |
-> CUInt | See "Extra compile options" below for possible bit flags. |
-> IO CInt |
:: Ptr Pcre2_compile_context | |
-> CUInt | See below for possible values. |
-> IO CInt |
pcre2_set_compile_recursion_guard :: Ptr Pcre2_compile_context -> FunPtr (CUInt -> Ptr a -> IO CInt) -> Ptr a -> IO CInt Source #
The match context
pcre2_match_context_free :: Ptr Pcre2_match_context -> IO () Source #
Match context setters
pcre2_set_callout :: Ptr Pcre2_match_context -> FunPtr (Ptr Pcre2_callout_block -> Ptr a -> IO CInt) -> Ptr a -> IO CInt Source #
pcre2_set_substitute_callout :: Ptr Pcre2_match_context -> FunPtr (Ptr Pcre2_substitute_callout_block -> Ptr a -> IO CInt) -> Ptr a -> IO CInt Source #
pcre2_set_offset_limit Source #
:: Ptr Pcre2_match_context | |
-> PCRE2_SIZE | Can be unset. See below. |
-> IO CInt |
pcre2_set_heap_limit :: Ptr Pcre2_match_context -> CUInt -> IO CInt Source #
pcre2_set_match_limit :: Ptr Pcre2_match_context -> CUInt -> IO CInt Source #
pcre2_set_depth_limit :: Ptr Pcre2_match_context -> CUInt -> IO CInt Source #
Checking build-time options
Compiling a pattern
:: PCRE2_SPTR | |
-> PCRE2_SIZE | Can be zero-terminated. See below. |
-> CUInt | See "Main compile options" below for possible bit flags. |
-> Ptr CInt | |
-> Ptr PCRE2_SIZE | |
-> Ptr Pcre2_compile_context | |
-> IO (Ptr Pcre2_code) |
pcre2_code_free :: Ptr Pcre2_code -> IO () Source #
pcre2_code_copy :: Ptr Pcre2_code -> IO (Ptr Pcre2_code) Source #
Main compile options
pcre2_DOTALL :: CUInt Source #
Extra compile options
JIT compilation
:: Ptr Pcre2_code | |
-> CUInt | See below for possible bit flags. |
-> IO CInt |
pcre2_ERROR_JIT_BADOPTION :: CInt Source #
May be returned by pcre2_jit_compile
.
:: Ptr Pcre2_code | |
-> PCRE2_SPTR | subject |
-> PCRE2_SIZE | length |
-> PCRE2_SIZE | startoffset |
-> CUInt | options |
-> Ptr Pcre2_match_data | |
-> Ptr Pcre2_match_context | |
-> IO CInt |
pcre2_jit_stack_create :: PCRE2_SIZE -> PCRE2_SIZE -> Ptr Pcre2_general_context -> IO (Ptr Pcre2_jit_stack) Source #
pcre2_jit_stack_assign :: Ptr Pcre2_match_context -> FunPtr (Ptr a -> IO (Ptr Pcre2_jit_stack)) -> Ptr a -> IO () Source #
pcre2_jit_stack_free :: Ptr Pcre2_jit_stack -> IO () Source #
Locale support
pcre2_maketables :: Ptr Pcre2_general_context -> IO (Ptr CUChar) Source #
pcre2_maketables_free :: Ptr Pcre2_general_context -> Ptr CUChar -> IO () Source #
Information about a compiled pattern
Duplicate capture group names
pcre2_substring_nametable_scan Source #
:: Ptr Pcre2_code | |
-> PCRE2_SPTR | name |
-> Ptr PCRE2_SPTR | first |
-> Ptr PCRE2_SPTR | last |
-> IO CInt |
Callouts
pcre2_callout_enumerate :: Ptr Pcre2_code -> FunPtr (Ptr Pcre2_callout_enumerate_block -> Ptr a -> IO CInt) -> Ptr a -> IO CInt Source #
Callout struct getters
These functions are not part of the official API; we provide them here. C API consumers are supposed to access struct fields directly, but the FFI cannot yet do that as of GHC 8.8.4.
pcre2_callout_block
pcre2_callout_block_callout_flags :: Ptr Pcre2_callout_block -> IO CUInt Source #
See below for possible bit flags.
pcre2_callout_enumerate_block
pcre2_callout_enumerate_block_pattern_position :: Ptr Pcre2_callout_enumerate_block -> IO PCRE2_SIZE Source #
pcre2_callout_enumerate_block_next_item_length :: Ptr Pcre2_callout_enumerate_block -> IO PCRE2_SIZE Source #
pcre2_callout_enumerate_block_callout_number :: Ptr Pcre2_callout_enumerate_block -> IO CUInt Source #
pcre2_callout_enumerate_block_callout_string_offset :: Ptr Pcre2_callout_enumerate_block -> IO PCRE2_SIZE Source #
pcre2_callout_enumerate_block_callout_string_length :: Ptr Pcre2_callout_enumerate_block -> IO PCRE2_SIZE Source #
pcre2_callout_enumerate_block_callout_string :: Ptr Pcre2_callout_enumerate_block -> IO PCRE2_SPTR Source #
pcre2_substitute_callout_block
pcre2_substitute_callout_block_input :: Ptr Pcre2_substitute_callout_block -> IO PCRE2_SPTR Source #
pcre2_substitute_callout_block_output :: Ptr Pcre2_substitute_callout_block -> IO PCRE2_SPTR Source #
pcre2_substitute_callout_block_ovector :: Ptr Pcre2_substitute_callout_block -> IO (Ptr PCRE2_SIZE) Source #
pcre2_substitute_callout_block_output_offsets :: Ptr Pcre2_substitute_callout_block -> IO (Ptr PCRE2_SIZE) Source #
Array of 2 (PCRE2_SIZE[2]
)
The match data block
pcre2_match_data_create Source #
:: CUInt | ovecsize |
-> Ptr Pcre2_general_context | |
-> IO (Ptr Pcre2_match_data) |
pcre2_match_data_create_from_pattern :: Ptr Pcre2_code -> Ptr Pcre2_general_context -> IO (Ptr Pcre2_match_data) Source #
pcre2_match_data_free :: Ptr Pcre2_match_data -> IO () Source #
Matching a pattern
:: Ptr Pcre2_code | |
-> PCRE2_SPTR | subject |
-> PCRE2_SIZE | length |
-> PCRE2_SIZE | startoffset |
-> CUInt | See below for possible bit flags. |
-> Ptr Pcre2_match_data | |
-> Ptr Pcre2_match_context | |
-> IO CInt |
Match options
pcre2_NOTBOL :: CUInt Source #
pcre2_NOTEOL :: CUInt Source #
pcre2_NO_JIT :: CUInt Source #
Match errors
UTF-16-specific errors
pcre2_ERROR_UTF16_ERR1 :: CInt Source #
"Missing low surrogate at end of string"
pcre2_ERROR_UTF16_ERR2 :: CInt Source #
"Invalid low surrogate follows high surrogate"
pcre2_ERROR_UTF16_ERR3 :: CInt Source #
"Isolated low surrogate"
DFA matching
:: Ptr Pcre2_code | |
-> PCRE2_SPTR | subject |
-> PCRE2_SIZE | length |
-> PCRE2_SIZE | startoffset |
-> CUInt | options |
-> Ptr Pcre2_match_data | |
-> Ptr Pcre2_match_context | |
-> Ptr CInt | workspace |
-> PCRE2_SIZE | wscount |
-> IO CInt |
DFA matching options
DFA matching errors
Returned string and captured substrings
pcre2_substring_length_bynumber Source #
:: Ptr Pcre2_match_data | |
-> CUInt | number |
-> Ptr PCRE2_SIZE | length |
-> IO CInt |
pcre2_substring_copy_bynumber Source #
:: Ptr Pcre2_match_data | |
-> CUInt | number |
-> Ptr PCRE2_UCHAR | buffer |
-> Ptr PCRE2_SIZE | bufflen |
-> IO CInt |
pcre2_substring_get_bynumber Source #
:: Ptr Pcre2_match_data | |
-> CUInt | name |
-> Ptr (Ptr PCRE2_UCHAR) | bufferptr |
-> Ptr PCRE2_SIZE | bufflen |
-> IO CInt |
pcre2_substring_list_get Source #
:: Ptr Pcre2_match_data | |
-> Ptr (Ptr (Ptr PCRE2_UCHAR)) | listptr |
-> Ptr (Ptr PCRE2_SIZE) | lengthsptr |
-> IO CInt |
pcre2_substring_list_free :: Ptr PCRE2_SPTR -> IO () Source #
pcre2_substring_number_from_name Source #
:: Ptr Pcre2_code | |
-> PCRE2_SPTR | name |
-> IO CInt |
pcre2_substring_length_byname Source #
:: Ptr Pcre2_match_data | |
-> PCRE2_SPTR | name |
-> Ptr PCRE2_SIZE | length |
-> IO CInt |
pcre2_substring_copy_byname Source #
:: Ptr Pcre2_match_data | |
-> PCRE2_SPTR | name |
-> Ptr PCRE2_UCHAR | buffer |
-> Ptr PCRE2_SIZE | bufflen |
-> IO CInt |
pcre2_substring_get_byname Source #
:: Ptr Pcre2_match_data | |
-> PCRE2_SPTR | name |
-> Ptr (Ptr PCRE2_UCHAR) | bufferptr |
-> Ptr PCRE2_SIZE | bufflen |
-> IO CInt |
pcre2_substring_free :: Ptr PCRE2_UCHAR -> IO () Source #
Creating a new string with substitutions
:: Ptr Pcre2_code | |
-> PCRE2_SPTR | subject |
-> PCRE2_SIZE | length |
-> PCRE2_SIZE | startoffset |
-> CUInt | options |
-> Ptr Pcre2_match_data | |
-> Ptr Pcre2_match_context | |
-> PCRE2_SPTR | replacement |
-> PCRE2_SIZE | rlength |
-> Ptr PCRE2_UCHAR | outputbuffer |
-> Ptr PCRE2_SIZE | outlengthptr |
-> IO CInt |
Substitution options
Substitution errors
Other information about a match
Obtaining a textual error message
pcre2_get_error_message :: CInt -> Ptr PCRE2_UCHAR -> PCRE2_SIZE -> IO CInt Source #
Pattern serialization
pcre2_serialize_decode Source #
:: Ptr (Ptr Pcre2_code) | codes |
-> CInt | number of codes |
-> Ptr CUInt | bytes |
-> Ptr Pcre2_general_context | |
-> IO CInt |
pcre2_serialize_encode Source #
:: Ptr (Ptr Pcre2_code) | codes |
-> CInt | number of codes |
-> Ptr (Ptr CUInt) | serialized bytes |
-> Ptr PCRE2_SIZE | serialized size |
-> Ptr Pcre2_general_context | |
-> IO CInt |