BDE 4.14.0 Production release
|
#include <bdlpcre_regex.h>
Public Types | |
enum | { k_FLAG_CASELESS = 1 << 0 , k_FLAG_DOTMATCHESALL = 1 << 1 , k_FLAG_MULTILINE = 1 << 2 , k_FLAG_UTF8 = 1 << 3 , k_FLAG_JIT = 1 << 4 , k_FLAG_DUPNAMES = 1 << 5 } |
enum | { k_REPLACE_LITERAL = 1 << 0 , k_REPLACE_GLOBAL = 1 << 1 , k_REPLACE_EXTENDED = 1 << 2 , k_REPLACE_UNKNOWN_UNSET = 1 << 3 , k_REPLACE_UNSET_EMPTY = 1 << 4 } |
enum | { k_STATUS_SUCCESS = 0 , k_STATUS_NO_MATCH = -1 , k_STATUS_DEPTH_LIMIT_FAILURE = 1 , k_STATUS_JIT_STACK_LIMIT_FAILURE = 2 , k_STATUS_UTF8_TRUNCATED_CHARACTER_FAILURE = 3 , k_STATUS_UTF8_SIGNIFICANT_BITS_VALUE_FAILURE = 4 , k_STATUS_UTF8_5_OR_6_BYTES_CHARACTER_FAILURE = 5 , k_STATUS_UTF8_4_BYTES_CHARACTER_RANGE_FAILURE = 6 , k_STATUS_UTF8_3_BYTES_CHARACTER_RANGE_FAILURE = 7 , k_STATUS_UTF8_OVERLONG_CHARACTER_FAILURE = 8 , k_STATUS_UTF8_FIRST_BYTE_SIGNIFICANT_BITS_FAILURE = 9 , k_STATUS_UTF8_FIRST_BYTE_WRONG_VALUE_FAILURE = 10 } |
Public Member Functions | |
BSLMF_NESTED_TRAIT_DECLARATION (RegEx, bslma::UsesBslmaAllocator) | |
RegEx (bslma::Allocator *basicAllocator=0) | |
~RegEx () | |
Destroy this regular-expression object. | |
void | clear () |
int | prepare (bsl::nullptr_t errorMessage, size_t *errorOffset, const char *pattern, int flags=0, size_t jitStackSize=0) |
template<class STRING > | |
bsl::enable_if< bsl::is_same< STRING, bsl::string >::value||bsl::is_same< STRING, std::string >::value, int >::type | prepare (STRING *errorMessage, size_t *errorOffset, const char *pattern, int flags=0, size_t jitStackSize=0) |
int | setDepthLimit (int depthLimit) |
int | depthLimit () const |
int | flags () const |
bool | isPrepared () const |
size_t | jitStackSize () const |
int | match (const bsl::string_view &subject, size_t subjectOffset=0) const |
int | match (const char *subject, size_t subjectLength, size_t subjectOffset=0) const |
int | match (bsl::pair< size_t, size_t > *result, const char *subject, size_t subjectLength, size_t subjectOffset=0) const |
int | match (bsl::string_view *result, const char *subject, size_t subjectLength, size_t subjectOffset=0) const |
int | match (bsl::string_view *result, const bsl::string_view &subject, size_t subjectOffset=0) const |
int | match (bsl::vector< bsl::pair< size_t, size_t > > *result, const char *subject, size_t subjectLength, size_t subjectOffset=0) const |
int | match (bsl::vector< bslstl::StringRef > *result, const char *subject, size_t subjectLength, size_t subjectOffset=0) const |
int | match (bsl::vector< bsl::string_view > *result, const bsl::string_view &subject, size_t subjectOffset=0) const |
int | match (std::vector< bsl::string_view > *result, const bsl::string_view &subject, size_t subjectOffset=0) const |
int | matchRaw (const bsl::string_view &subject, size_t subjectOffset=0) const |
int | matchRaw (const char *subject, size_t subjectLength, size_t subjectOffset=0) const |
int | matchRaw (bsl::pair< size_t, size_t > *result, const char *subject, size_t subjectLength, size_t subjectOffset=0) const |
int | matchRaw (bsl::string_view *result, const char *subject, size_t subjectLength, size_t subjectOffset=0) const |
int | matchRaw (bsl::string_view *result, const bsl::string_view &subject, size_t subjectOffset=0) const |
int | matchRaw (bsl::vector< bsl::pair< size_t, size_t > > *result, const char *subject, size_t subjectLength, size_t subjectOffset=0) const |
int | matchRaw (bsl::vector< bslstl::StringRef > *result, const char *subject, size_t subjectLength, size_t subjectOffset=0) const |
int | matchRaw (bsl::vector< bsl::string_view > *result, const bsl::string_view &subject, size_t subjectOffset=0) const |
int | matchRaw (std::vector< bsl::string_view > *result, const bsl::string_view &subject, size_t subjectOffset=0) const |
void | namedSubpatterns (bsl::vector< bsl::pair< bsl::string_view, int > > *result) const |
void | namedSubpatterns (std::vector< std::pair< bsl::string_view, int > > *result) const |
int | numSubpatterns () const |
const bsl::string & | pattern () const |
int | replace (bsl::string *result, int *errorOffset, const bsl::string_view &subject, const bsl::string_view &replacement, size_t options=0) const |
int | replace (std::string *result, int *errorOffset, const bsl::string_view &subject, const bsl::string_view &replacement, size_t options=0) const |
int | replaceRaw (bsl::string *result, int *errorOffset, const bsl::string_view &subject, const bsl::string_view &replacement, size_t options=0) const |
int | replaceRaw (std::string *result, int *errorOffset, const bsl::string_view &subject, const bsl::string_view &replacement, size_t options=0) const |
int | subpatternIndex (const char *name) const |
Static Public Member Functions | |
static int | defaultDepthLimit () |
Return the process-wide default evaluation recursion depth limit. | |
static bool | isJitAvailable () |
static int | setDefaultDepthLimit (int depthLimit) |
Static Public Attributes | |
static const size_t | k_INVALID_OFFSET |
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/
).
See bdlpcre_regex
anonymous enum |
anonymous enum |
anonymous enum |
Enumerator | |
---|---|
k_STATUS_SUCCESS | successful completion of the operation |
k_STATUS_NO_MATCH | the subject string did not match the pattern |
k_STATUS_DEPTH_LIMIT_FAILURE |
|
k_STATUS_JIT_STACK_LIMIT_FAILURE | memory available for the JIT stack is not large enough (applicable only if |
k_STATUS_UTF8_TRUNCATED_CHARACTER_FAILURE | the UTF-8 string ends with a truncated UTF-8 character |
k_STATUS_UTF8_SIGNIFICANT_BITS_VALUE_FAILURE | the two most significant bits of the 2nd, 3rd or 4th byte of the UTF-8 character do not have the binary value 0b10 |
k_STATUS_UTF8_5_OR_6_BYTES_CHARACTER_FAILURE | a UTF-8 character is either 5 or 6 bytes long |
k_STATUS_UTF8_4_BYTES_CHARACTER_RANGE_FAILURE | a 4-byte UTF-8 character has a value greater than 0x10ffff |
k_STATUS_UTF8_3_BYTES_CHARACTER_RANGE_FAILURE | a 3-byte UTF-8 character has a value in the range 0xd800 to 0xdfff |
k_STATUS_UTF8_OVERLONG_CHARACTER_FAILURE | a 2-, 3- or 4-byte UTF-8 character is "overlong", i.e. it codes for a value that can be represented by fewer bytes |
k_STATUS_UTF8_FIRST_BYTE_SIGNIFICANT_BITS_FAILURE | the two most significant bits of the first byte of a UTF-8 character have the binary value 0b10 |
k_STATUS_UTF8_FIRST_BYTE_WRONG_VALUE_FAILURE | the first byte of a UTF-8 character has the value 0xfe or 0xff |
bdlpcre::RegEx::RegEx | ( | bslma::Allocator * | basicAllocator = 0 | ) |
Create a regular-expression object in the "unprepared" state. Optionally specify a basicAllocator
used to supply memory. The alignment strategy of the allocator must be "maximum" or "natural". If basicAllocator
is 0, the currently installed default allocator is used.
|
inline |
bdlpcre::RegEx::BSLMF_NESTED_TRAIT_DECLARATION | ( | RegEx | , |
bslma::UsesBslmaAllocator | |||
) |
void bdlpcre::RegEx::clear | ( | ) |
|
inlinestatic |
|
inline |
Return the evaluation recursion depth limit for this regular-expression object.
|
inline |
Return the flags that were supplied to the most recent successful call to the prepare
method of this regular-expression object. The behavior is undefined unless isPrepared() == true
. Note that the returned value will be the bit-wise inclusive-or of 0 or more of the following values:
Also note that k_FLAG_JIT
is ignored, but still returned by this method, if isJitAvailable()
is false
.
|
static |
Return true
if just-in-time compiling optimization is supported by current hardware platform and false
otherwise. Note that JIT support is limited to the following hardware platforms:
|
inline |
Return true
if this regular-expression object is in the "prepared" state, and false
otherwise.
|
inline |
Return the size of the dynamically allocated JIT stack if it has been specified explicitly with the prepare
method. Return 0 if a zero jitStackSize
value was passed to the prepare
method (or not supplied at all) or if isPrepared()
is false
.
int bdlpcre::RegEx::match | ( | bsl::pair< size_t, size_t > * | result, |
const char * | subject, | ||
size_t | subjectLength, | ||
size_t | subjectOffset = 0 |
||
) | const |
Match the specified subject
having the specified subjectLength
against pattern()
. Begin matching at the optionally specified subjectOffset
in subject
. If subjectOffset
is not specified, matching begins at the start of subject
. subject
may contain embedded null characters. UTF-8 validity checking is performed on subject
if pattern()
was prepared with k_FLAG_UTF8
. Return k_STATUS_SUCCESS
on success, k_STATUS_NO_MATCH
if a match is not found, and another value if an error occurs. If the returned status is not k_STATUS_SUCCESS
or k_STATUS_NO_MATCH
it may match one of specific k_STATUS_*
error return constants defined above (but is not guaranteed to). result
is unchanged if a value other than k_STATUS_SUCCESS
is returned. The behavior is undefined unless true == isPrepared()
, subject || 0 == subjectLength
, and subjectOffset <= subjectLength
. Note that JIT optimization is disabled if pattern()
was prepared with k_FLAG_UTF8
; use matchRaw
if JIT is preferred and UTF-8 validation of subject
is not required.
int bdlpcre::RegEx::match | ( | bsl::string_view * | result, |
const bsl::string_view & | subject, | ||
size_t | subjectOffset = 0 |
||
) | const |
Match the specified subject
against pattern()
. Begin matching at the optionally specified subjectOffset
in subject
. If subjectOffset
is not specified, matching begins at the start of subject
. UTF-8 validity checking is performed on subject
if pattern()
was prepared with k_FLAG_UTF8
. Return k_STATUS_SUCCESS
on success, k_STATUS_NO_MATCH
if a match is not found, and another value if an error occurs. If the returned status is not k_STATUS_SUCCESS
or k_STATUS_NO_MATCH
it may match one of specific k_STATUS_*
error return constants defined above (but is not guaranteed to). result
is unchanged if a value other than k_STATUS_SUCCESS
is returned. The behavior is undefined unless true == isPrepared()
and subjectOffset <= subject.length()
. Note that JIT optimization is disabled if pattern()
was prepared with k_FLAG_UTF8
; use matchRaw
if JIT is preferred and UTF-8 validation of subject
is not required.
int bdlpcre::RegEx::match | ( | bsl::string_view * | result, |
const char * | subject, | ||
size_t | subjectLength, | ||
size_t | subjectOffset = 0 |
||
) | const |
int bdlpcre::RegEx::match | ( | bsl::vector< bsl::pair< size_t, size_t > > * | result, |
const char * | subject, | ||
size_t | subjectLength, | ||
size_t | subjectOffset = 0 |
||
) | const |
Match the specified subject
having the specified subjectLength
against pattern()
. Begin matching at the optionally specified subjectOffset
in subject
. If subjectOffset
is not specified, matching begins at the start of subject
. subject
may contain embedded null characters. UTF-8 validity checking is performed on subject
if pattern()
was prepared with k_FLAG_UTF8
. On success:
result
with, respectively, a (offset, length)
pair or a bslstl::StringRef
indicating the leftmost match of pattern()
.result
in the range [1 .. numSubpatterns()]
with, respectively, a (offset, length)
pair or a bslstl::StringRef
indicating the respective matches of sub-patterns (unmatched sub-patterns have their respective result
elements loaded with either the (k_INVALID_OFFSET, 0)
pair or an empty bslstl::StringRef
); sub-patterns matching multiple times have their respective result
elements loaded with the pairs or bslstl::StringRef
indicating the rightmost match, and return k_STATUS_SUCCESS
.Otherwise, return k_STATUS_NO_MATCH
if a match is not found, and another value if an error occurs. If the returned status is not k_STATUS_SUCCESS
or k_STATUS_NO_MATCH
it may match one of specific k_STATUS_*
error return constants defined above (but is not guaranteed to). result
is unchanged if a value other than k_STATUS_SUCCESS
is returned. The behavior is undefined unless true == isPrepared()
, subject || 0 == subjectLength
, and subjectOffset <= subjectLength
. Note that JIT optimization is disabled if pattern()
was prepared with k_FLAG_UTF8
; use matchRaw
if JIT is preferred and UTF-8 validation of subject
is not required. Also note that after a successful call, result
will contain exactly numSubpatterns() + 1
elements.
int bdlpcre::RegEx::match | ( | bsl::vector< bsl::string_view > * | result, |
const bsl::string_view & | subject, | ||
size_t | subjectOffset = 0 |
||
) | const |
int bdlpcre::RegEx::match | ( | bsl::vector< bslstl::StringRef > * | result, |
const char * | subject, | ||
size_t | subjectLength, | ||
size_t | subjectOffset = 0 |
||
) | const |
int bdlpcre::RegEx::match | ( | const bsl::string_view & | subject, |
size_t | subjectOffset = 0 |
||
) | const |
Match the specified subject
against pattern()
. Begin matching at the optionally specified subjectOffset
in subject
. If subjectOffset
is not specified, matching begins at the start of subject
. UTF-8 validity checking is performed on subject
if pattern()
was prepared with k_FLAG_UTF8
. Return k_STATUS_SUCCESS
on success, k_STATUS_NO_MATCH
if a match is not found, and another value if an error occurs. If the returned status is not k_STATUS_SUCCESS
or k_STATUS_NO_MATCH
it may match one of specific k_STATUS_*
error return constants defined above (but is not guaranteed to). The behavior is undefined unless true == isPrepared()
and subjectOffset <= subject.length()
. Note that JIT optimization is disabled if pattern()
was prepared with k_FLAG_UTF8
; use matchRaw
if JIT is preferred and UTF-8 validation of subject
is not required.
int bdlpcre::RegEx::match | ( | const char * | subject, |
size_t | subjectLength, | ||
size_t | subjectOffset = 0 |
||
) | const |
Match the specified subject
having the specified subjectLength
against pattern()
. Begin matching at the optionally specified subjectOffset
in subject
. If subjectOffset
is not specified, matching begins at the start of subject
. subject
may contain embedded null characters. UTF-8 validity checking is performed on subject
if pattern()
was prepared with k_FLAG_UTF8
. Return k_STATUS_SUCCESS
on success, k_STATUS_NO_MATCH
if a match is not found, and another value if an error occurs. If the returned status is not k_STATUS_SUCCESS
or k_STATUS_NO_MATCH
it may match one of specific k_STATUS_*
error return constants defined above (but is not guaranteed to). The behavior is undefined unless true == isPrepared()
, subject || 0 == subjectLength
, and subjectOffset <= subjectLength
. Note that JIT optimization is disabled if pattern()
was prepared with k_FLAG_UTF8
; use matchRaw
if JIT is preferred and UTF-8 validation of subject
is not required.
int bdlpcre::RegEx::match | ( | std::vector< bsl::string_view > * | result, |
const bsl::string_view & | subject, | ||
size_t | subjectOffset = 0 |
||
) | const |
int bdlpcre::RegEx::matchRaw | ( | bsl::pair< size_t, size_t > * | result, |
const char * | subject, | ||
size_t | subjectLength, | ||
size_t | subjectOffset = 0 |
||
) | const |
Match the specified subject
having the specified subjectLength
against pattern()
. Begin matching at the optionally specified subjectOffset
in subject
. If subjectOffset
is not specified, matching begins at the start of subject
. subject
may contain embedded null characters. Return k_STATUS_SUCCESS
on success, k_STATUS_NO_MATCH
if a match is not found, and another value if an error occurs. If the returned status is not k_STATUS_SUCCESS
or k_STATUS_NO_MATCH
it may match one of specific k_STATUS_*
error return constants defined above (but is not guaranteed to). result
is unchanged if a value other than k_STATUS_SUCCESS
is returned. The behavior is undefined unless true == isPrepared()
, subject || 0 == subjectLength
, subjectOffset <= subjectLength
, and subject
is valid UTF-8 if pattern()
was prepared with k_FLAG_UTF8
.
int bdlpcre::RegEx::matchRaw | ( | bsl::string_view * | result, |
const bsl::string_view & | subject, | ||
size_t | subjectOffset = 0 |
||
) | const |
Match the specified subject
against pattern()
. Begin matching at the optionally specified subjectOffset
in subject
. If subjectOffset
is not specified, matching begins at the start of subject
. Return k_STATUS_SUCCESS
on success, k_STATUS_NO_MATCH
if a match is not found, and another value if an error occurs. If the returned status is not k_STATUS_SUCCESS
or k_STATUS_NO_MATCH
it may match one of specific k_STATUS_*
error return constants defined above (but is not guaranteed to). result
is unchanged if a value other than k_STATUS_SUCCESS
is returned. The behavior is undefined unless true == isPrepared()
, subjectOffset <= subject.length()
, and subject
is valid UTF-8 if pattern()
was prepared with k_FLAG_UTF8
.
int bdlpcre::RegEx::matchRaw | ( | bsl::string_view * | result, |
const char * | subject, | ||
size_t | subjectLength, | ||
size_t | subjectOffset = 0 |
||
) | const |
int bdlpcre::RegEx::matchRaw | ( | bsl::vector< bsl::pair< size_t, size_t > > * | result, |
const char * | subject, | ||
size_t | subjectLength, | ||
size_t | subjectOffset = 0 |
||
) | const |
Match the specified subject
having the specified subjectLength
against pattern()
. Begin matching at the optionally specified subjectOffset
in subject
. If subjectOffset
is not specified, matching begins at the start of subject
. subject
may contain embedded null characters. On success:
result
with, respectively, a (offset, length)
pair or a bslstl::StringRef
indicating the leftmost match of pattern()
.result
in the range [1 .. numSubpatterns()]
with, respectively, a (offset, length)
pair or a bslstl::StringRef
indicating the respective matches of sub-patterns (unmatched sub-patterns have their respective result
elements loaded with either the (k_INVALID_OFFSET, 0)
pair or an empty bslstl::StringRef
); sub-patterns matching multiple times have their respective result
elements loaded with the pairs or bslstl::StringRef
indicating the rightmost match, and return k_STATUS_SUCCESS
.Otherwise, return k_STATUS_NO_MATCH
if a match is not found, and another value if an error occurs. If the returned status is not k_STATUS_SUCCESS
or k_STATUS_NO_MATCH
it may match one of specific k_STATUS_*
error return constants defined above (but is not guaranteed to). result
is unchanged if a value other than k_STATUS_SUCCESS
is returned. The behavior is undefined unless true == isPrepared()
, subject || 0 == subjectLength
, subjectOffset <= subjectLength
, and subject
is valid UTF-8 if pattern()
was prepared with k_FLAG_UTF8
. Note that after a successful call, result
will contain exactly numSubpatterns() + 1
elements.
int bdlpcre::RegEx::matchRaw | ( | bsl::vector< bsl::string_view > * | result, |
const bsl::string_view & | subject, | ||
size_t | subjectOffset = 0 |
||
) | const |
int bdlpcre::RegEx::matchRaw | ( | bsl::vector< bslstl::StringRef > * | result, |
const char * | subject, | ||
size_t | subjectLength, | ||
size_t | subjectOffset = 0 |
||
) | const |
int bdlpcre::RegEx::matchRaw | ( | const bsl::string_view & | subject, |
size_t | subjectOffset = 0 |
||
) | const |
Match the specified subject
against pattern()
. Begin matching at the optionally specified subjectOffset
in subject
. If subjectOffset
is not specified, matching begins at the start of subject
. Return k_STATUS_SUCCESS
on success, k_STATUS_NO_MATCH
if a match is not found, and another value if an error occurs. If the returned status is not k_STATUS_SUCCESS
or k_STATUS_NO_MATCH
it may match one of specific k_STATUS_*
error return constants defined above (but is not guaranteed to). The behavior is undefined unless true == isPrepared()
, subjectOffset <= subject.length()
, and subject
is valid UTF-8 if pattern()
was prepared with k_FLAG_UTF8
.
int bdlpcre::RegEx::matchRaw | ( | const char * | subject, |
size_t | subjectLength, | ||
size_t | subjectOffset = 0 |
||
) | const |
Match the specified subject
having the specified subjectLength
against pattern()
. Begin matching at the optionally specified subjectOffset
in subject
. If subjectOffset
is not specified, matching begins at the start of subject
. subject
may contain embedded null characters. Return k_STATUS_SUCCESS
on success, k_STATUS_NO_MATCH
if a match is not found, and another value if an error occurs. If the returned status is not k_STATUS_SUCCESS
or k_STATUS_NO_MATCH
it may match one of specific k_STATUS_*
error return constants defined above (but is not guaranteed to). The behavior is undefined unless true == isPrepared()
, subject || 0 == subjectLength
, subjectOffset <= subjectLength
, and subject
is valid UTF-8 if pattern()
was prepared with k_FLAG_UTF8
.
int bdlpcre::RegEx::matchRaw | ( | std::vector< bsl::string_view > * | result, |
const bsl::string_view & | subject, | ||
size_t | subjectOffset = 0 |
||
) | const |
void bdlpcre::RegEx::namedSubpatterns | ( | bsl::vector< bsl::pair< bsl::string_view, int > > * | result | ) | const |
void bdlpcre::RegEx::namedSubpatterns | ( | std::vector< std::pair< bsl::string_view, int > > * | result | ) | const |
int bdlpcre::RegEx::numSubpatterns | ( | ) | const |
Return the number of sub-patterns in the pattern held by this regular-expression object (pattern()
). The behavior is undefined unless isPrepared() == true
.
|
inline |
Return a reference to the non-modifiable pattern held by this regular-expression object. The behavior is undefined unless isPrepared() == true
.
int bdlpcre::RegEx::prepare | ( | bsl::nullptr_t | errorMessage, |
size_t * | errorOffset, | ||
const char * | pattern, | ||
int | flags = 0 , |
||
size_t | jitStackSize = 0 |
||
) |
Free resources used by this regular-expression object and put this object into the "unprepared" state. This method has no effect if this object is already in the "unprepared" state.
bsl::enable_if< bsl::is_same< STRING, bsl::string >::value||bsl::is_same< STRING, std::string >::value, int >::type bdlpcre::RegEx::prepare | ( | STRING * | errorMessage, |
size_t * | errorOffset, | ||
const char * | pattern, | ||
int | flags = 0 , |
||
size_t | jitStackSize = 0 |
||
) |
Prepare this regular-expression object with the specified pattern
and the optionally specified flags
. flags
, if supplied, should contain a bit-wise or of the k_FLAG_*
constants defined by this class, which indicate additional configuration parameters for the regular expression. Optionally specify jitStackSize
. If flags
has the k_FLAG_JIT
flag set, jitStackSize
indicates the size of the allocated JIT stack to be used for this pattern. If flags
has the k_FLAG_JIT
bit set and jitStackSize
is 0 (or not supplied), no memory will be allocated for the JIT stack and the program stack will be used as the JIT stack. If flags
does not have k_FLAG_JIT
set, or isJitAvailable()
is false
, the jitStackSize
parameter, if supplied, is ignored. On success, put this object into the "prepared" state and return 0, with no effect on the specified errorMessage
and errorOffset
. Otherwise, (1) put this object into the "unprepared" state, (2) load errorMessage
(if non-null) with a string describing the error detected, (3) load errorOffset
(if non-null) with the offset in pattern
at which the error was detected, and (4) return a non-zero value. The behavior is undefined unless flags
is the bit-wise inclusive-or of 0 or more of the following values:
Note that the flag k_FLAG_JIT
is ignored if isJitAvailable()
is false
.
int bdlpcre::RegEx::replace | ( | bsl::string * | result, |
int * | errorOffset, | ||
const bsl::string_view & | subject, | ||
const bsl::string_view & | replacement, | ||
size_t | options = 0 |
||
) | const |
int bdlpcre::RegEx::replace | ( | std::string * | result, |
int * | errorOffset, | ||
const bsl::string_view & | subject, | ||
const bsl::string_view & | replacement, | ||
size_t | options = 0 |
||
) | const |
int bdlpcre::RegEx::replaceRaw | ( | bsl::string * | result, |
int * | errorOffset, | ||
const bsl::string_view & | subject, | ||
const bsl::string_view & | replacement, | ||
size_t | options = 0 |
||
) | const |
int bdlpcre::RegEx::replaceRaw | ( | std::string * | result, |
int * | errorOffset, | ||
const bsl::string_view & | subject, | ||
const bsl::string_view & | replacement, | ||
size_t | options = 0 |
||
) | const |
|
inlinestatic |
Set the process-wide default evaluation recursion depth limit to the specified depthLimit
. Return the previous depth limit.
int bdlpcre::RegEx::setDepthLimit | ( | int | depthLimit | ) |
Set the evaluation recursion depth limit for this regular-expression object to the specified depthLimit
. Return the previous depth limit.
int bdlpcre::RegEx::subpatternIndex | ( | const char * | name | ) | const |
Return the 1-based index of the sub-pattern having the specified name
in the pattern held by this regular-expression object (pattern()
); return -1 if pattern()
does not contain a sub-pattern identified by name
or name
is not unique. The behavior is undefined unless isPrepared() == true
. Note that the returned value is intended to be used as an index into the bsl::vector<bsl::pair<int, int> >
returned by match
. Also note that the function namedSubpatterns
can be used to find the sub-pattern index when there are duplicate named sub-patterns.
|
static |
Value used to denote an invalid offset for match methods returning pairs.