Mechanism for compiling and matching regular expressions.

Synopsis

Declared in <bdlpcre_regex.h>

class RegEx;

Description

This class provides a mechanism for compiling and matching regular expressions. A regular expression approximately compatible with Perl 5.10 is compiled with the prepare method. Subsequently, strings are matched against the compiled (prepared) pattern using the overloaded match and matchRaw methods. Note that the underlying implementation uses the open‐source Perl Compatible Regular Expressions (PCRE2) library that was developed at the University of Cambridge (http://www.pcre.org/).

Enums

Name

Description

Unnamed enum

Flags that may be supplied to prepare to affect matching behavior.

Unnamed enum

Flags that may be supplied to replace to affect replacement behavior.

Unnamed enum

Status codes distinguishing among results of match operations.

Member Functions

Name

Description

RegEx [constructor]

Create a regular‐expression object in the "unprepared" state.

~RegEx [destructor]

Destroy this regular‐expression object.

clear

Free resources and put this object into the "unprepared" state.

depthLimit

Return the evaluation recursion depth limit for this regular‐expression object.

flags

Return the flags from the most recent successful prepare call.

isPrepared

Return true if this regular‐expression object is in the "prepared" state, and false otherwise.

jitStackSize

Return the explicitly configured JIT stack size, or 0.

match

match overloads

matchRaw

matchRaw overloads

namedSubpatterns

namedSubpatterns overloads

numSubpatterns

Return the number of sub‐patterns in the pattern held by this regular‐expression object (pattern()). The behavior is undefined unless isPrepared() == true.

pattern

Return a reference to the non‐modifiable pattern held by this regular‐expression object. The behavior is undefined unless isPrepared() == true.

prepare

prepare overloads

replace

replace overloads

replaceRaw

replaceRaw overloads

setDepthLimit

Set the evaluation recursion depth limit for this object.

subpatternIndex

Return the 1‐based index of the named sub‐pattern, or ‐1.

operator BloombergLP::bslmf::NestedTraitDeclaration<RegEx, UsesBslmaAllocator>

Declare that this type uses a bslma allocator.

Static Member Functions

Name

Description

defaultDepthLimit

Return the process‐wide default evaluation recursion depth limit.

isJitAvailable

Return whether just‐in‐time compiling is supported on this platform.

setDefaultDepthLimit

Set the process‐wide default evaluation recursion depth limit.

Static Data Members

Name

Description

k_INVALID_OFFSET

Value used to denote an invalid offset for match methods returning pairs.

Created with MrDocs