HORIZON HASKELLDocslts/ghc-10.0.x8fef28d2026-11-02Search packagesCtrl K
Theme: |

GHC 10.0.0.20260917 · lts/ghc-10.0.x · 8fef28d · 2026-11-02

Modulepcre2-2.3.1GHC2021

Text.Regex.Pcre2.Foreign

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.

Contents
  1. Types
  2. Opaque types
  3. The general context
  4. The compile context
  5. Compile context setters
  6. The match context
  7. Match context setters
  8. Checking build-time options
  9. Compiling a pattern
  10. Main compile options
  11. Extra compile options
  12. Locale support
  13. Information about a compiled pattern
  14. Duplicate capture group names
  15. Callouts
  16. Callout struct getters
  17. pcre2_callout_block
  18. pcre2_callout_enumerate_block
  19. pcre2_substitute_callout_block
  20. The match data block
  21. Matching a pattern
  22. Match options
  23. Match errors
  24. UTF-16-specific errors
  25. DFA matching
  26. DFA matching options
  27. DFA matching errors
  28. Returned string and captured substrings
  29. Creating a new string with substitutions
  30. Substitution options
  31. Substitution errors
  32. Other information about a match
  33. Obtaining a textual error message
  34. Iterating over all matches
  35. Pattern serialization
Synopsis
  • Packagepcre2-2.3.1
  • Exports247
  • LanguageGHC2021
  • LicenceApache-2.0
  • SourceForeign.hs

Types

typetype PCRE2_UCHAR = CUChar

"The UCHAR types define unsigned code units of the appropriate widths. For example, PCRE2_UCHAR16 is usually defined as uint16_t."

"The SPTR types are constant pointers to the equivalent UCHAR types, that is, they are pointers to vectors of unsigned code units."

typetype PCRE2_SIZE = CSize

"...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.

The general context

The compile context

Compile context setters

The match context

Match context setters

Checking build-time options

Compiling a pattern

Main compile options

Extra compile options

Locale support

Information about a compiled pattern

Duplicate capture group names

Callouts

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_enumerate_block

pcre2_substitute_callout_block

The match data block

Matching a pattern

Match options

Match errors

UTF-16-specific errors

DFA matching

DFA matching options

DFA matching errors

Returned string and captured substrings

Creating a new string with substitutions

Substitution options

Substitution errors

Other information about a match

Obtaining a textual error message

Iterating over all matches

Pattern serialization