ADTF
3.18.2
|
Regular expressions. More...
Public Types | |
enum | tAnchorType { AT_Unanchored , AT_Start , AT_Both } |
Anchor type. | |
Static Public Attributes | |
static cRegularExpressionArg | oNoArg |
No argument. | |
Private Attributes | |
tVoid * | m_pInternalObj |
tBool | m_bIsCaseSensitive |
Regular expressions.
Definition at line 18 of file builds/digitalwerk/solutions/adtf_content/adtf_base/adtf_core/src/libraries/a_utils/include/a_utils/std/regularexpression.h.
Default constructor.
The matching is set to case sensitive.
cRegularExpression | ( | const cRegularExpression & | oRegExp | ) |
Copy constructor.
oRegExp | [in] The object to copy. |
cRegularExpression | ( | const cString & | strExpression | ) |
Constructor with preset expression.
The matching is set to case sensitive.
strExpression | [in] The regular expression string. |
cRegularExpression | ( | const tChar * | strExpression, |
tBool | bCaseSensitive = tTrue |
||
) |
Constructor with preset expression.
strExpression | [in] The regular expression string. |
bCaseSensitive | [in] Whether or not the match is case sensitive. |
tBool Consume | ( | cStringPiece & | input, |
const cRegularExpressionArg & | ptr1 = oNoArg , |
||
const cRegularExpressionArg & | ptr2 = oNoArg , |
||
const cRegularExpressionArg & | ptr3 = oNoArg , |
||
const cRegularExpressionArg & | ptr4 = oNoArg , |
||
const cRegularExpressionArg & | ptr5 = oNoArg , |
||
const cRegularExpressionArg & | ptr6 = oNoArg , |
||
const cRegularExpressionArg & | ptr7 = oNoArg , |
||
const cRegularExpressionArg & | ptr8 = oNoArg , |
||
const cRegularExpressionArg & | ptr9 = oNoArg , |
||
const cRegularExpressionArg & | ptr10 = oNoArg , |
||
const cRegularExpressionArg & | ptr11 = oNoArg , |
||
const cRegularExpressionArg & | ptr12 = oNoArg , |
||
const cRegularExpressionArg & | ptr13 = oNoArg , |
||
const cRegularExpressionArg & | ptr14 = oNoArg , |
||
const cRegularExpressionArg & | ptr15 = oNoArg , |
||
const cRegularExpressionArg & | ptr16 = oNoArg |
||
) | const |
Repeatedly match the front of a string.
Advance the position of the input past the matching part.
input | [inout] The input text. Will be advanced past the matching part. |
ptr1 | [inout] The capturing argument 1. |
ptr2 | [inout] The capturing argument 2. |
ptr3 | [inout] The capturing argument 3. |
ptr4 | [inout] The capturing argument 4. |
ptr5 | [inout] The capturing argument 5. |
ptr6 | [inout] The capturing argument 6. |
ptr7 | [inout] The capturing argument 7. |
ptr8 | [inout] The capturing argument 8. |
ptr9 | [inout] The capturing argument 9. |
ptr10 | [inout] The capturing argument 10. |
ptr11 | [inout] The capturing argument 11. |
ptr12 | [inout] The capturing argument 12. |
ptr13 | [inout] The capturing argument 13. |
ptr14 | [inout] The capturing argument 14. |
ptr15 | [inout] The capturing argument 15. |
ptr16 | [inout] The capturing argument 16. |
tBool DoMatch | ( | const cStringPiece & | text, |
tAnchorType | anchor, | ||
tInt * | consumed, | ||
const cRegularExpressionArg * | args, | ||
tInt | n | ||
) | const |
Matches a string.
text | [in] The string to match. |
anchor | [in] See tAnchorType. |
consumed | [out] The length of the match. |
args | [out] Array of capturing args. One arg per capuring group |
n | [in] The size of args. |
tBool Extract | ( | const cStringPiece & | rewrite, |
const cStringPiece & | text, | ||
cString * | out | ||
) | const |
Extracts all replaced matches of text into out.
rewrite | [in] The string to match. |
text | [out] The output string. |
out | [out] If the pattern matches, rewrite is copied to this string |
tBool FindAndConsume | ( | cStringPiece & | input, |
const cRegularExpressionArg & | ptr1 = oNoArg , |
||
const cRegularExpressionArg & | ptr2 = oNoArg , |
||
const cRegularExpressionArg & | ptr3 = oNoArg , |
||
const cRegularExpressionArg & | ptr4 = oNoArg , |
||
const cRegularExpressionArg & | ptr5 = oNoArg , |
||
const cRegularExpressionArg & | ptr6 = oNoArg , |
||
const cRegularExpressionArg & | ptr7 = oNoArg , |
||
const cRegularExpressionArg & | ptr8 = oNoArg , |
||
const cRegularExpressionArg & | ptr9 = oNoArg , |
||
const cRegularExpressionArg & | ptr10 = oNoArg , |
||
const cRegularExpressionArg & | ptr11 = oNoArg , |
||
const cRegularExpressionArg & | ptr12 = oNoArg , |
||
const cRegularExpressionArg & | ptr13 = oNoArg , |
||
const cRegularExpressionArg & | ptr14 = oNoArg , |
||
const cRegularExpressionArg & | ptr15 = oNoArg , |
||
const cRegularExpressionArg & | ptr16 = oNoArg |
||
) | const |
Repeatedly match a string.
Advance the position of the input past the first matching part.
input | [inout] The input text. Will be advanced past the matching part. |
ptr1 | [inout] The capturing argument 1. |
ptr2 | [inout] The capturing argument 2. |
ptr3 | [inout] The capturing argument 3. |
ptr4 | [inout] The capturing argument 4. |
ptr5 | [inout] The capturing argument 5. |
ptr6 | [inout] The capturing argument 6. |
ptr7 | [inout] The capturing argument 7. |
ptr8 | [inout] The capturing argument 8. |
ptr9 | [inout] The capturing argument 9. |
ptr10 | [inout] The capturing argument 10. |
ptr11 | [inout] The capturing argument 11. |
ptr12 | [inout] The capturing argument 12. |
ptr13 | [inout] The capturing argument 13. |
ptr14 | [inout] The capturing argument 14. |
ptr15 | [inout] The capturing argument 15. |
ptr16 | [inout] The capturing argument 16. |
tBool FullMatch | ( | const cStringPiece & | text, |
const cRegularExpressionArg & | ptr1 = oNoArg , |
||
const cRegularExpressionArg & | ptr2 = oNoArg , |
||
const cRegularExpressionArg & | ptr3 = oNoArg , |
||
const cRegularExpressionArg & | ptr4 = oNoArg , |
||
const cRegularExpressionArg & | ptr5 = oNoArg , |
||
const cRegularExpressionArg & | ptr6 = oNoArg , |
||
const cRegularExpressionArg & | ptr7 = oNoArg , |
||
const cRegularExpressionArg & | ptr8 = oNoArg , |
||
const cRegularExpressionArg & | ptr9 = oNoArg , |
||
const cRegularExpressionArg & | ptr10 = oNoArg , |
||
const cRegularExpressionArg & | ptr11 = oNoArg , |
||
const cRegularExpressionArg & | ptr12 = oNoArg , |
||
const cRegularExpressionArg & | ptr13 = oNoArg , |
||
const cRegularExpressionArg & | ptr14 = oNoArg , |
||
const cRegularExpressionArg & | ptr15 = oNoArg , |
||
const cRegularExpressionArg & | ptr16 = oNoArg |
||
) | const |
Checks if the whole string matches.
text | [in] The string to match. |
ptr1 | [inout] The capturing argument 1. |
ptr2 | [inout] The capturing argument 2. |
ptr3 | [inout] The capturing argument 3. |
ptr4 | [inout] The capturing argument 4. |
ptr5 | [inout] The capturing argument 5. |
ptr6 | [inout] The capturing argument 6. |
ptr7 | [inout] The capturing argument 7. |
ptr8 | [inout] The capturing argument 8. |
ptr9 | [inout] The capturing argument 9. |
ptr10 | [inout] The capturing argument 10. |
ptr11 | [inout] The capturing argument 11. |
ptr12 | [inout] The capturing argument 12. |
ptr13 | [inout] The capturing argument 13. |
ptr14 | [inout] The capturing argument 14. |
ptr15 | [inout] The capturing argument 15. |
ptr16 | [inout] The capturing argument 16. |
cString GetError | ( | ) | const |
Returns a string representation of the last error (if any).
tInt GetNumberOfCapturingGroups | ( | ) | const |
Returns the number of capturing groups.
Example for 2 capturing groups: oRegExp.Set("(bl.bber)(b.l)");
cString GetPattern | ( | ) | const |
Returns the current pattern (expression).
tInt GlobalReplace | ( | const cStringPiece & | rewrite, |
cString * | str | ||
) | const |
Replaces all matches of str with rewrite.
rewrite | [in] The replacement. Backslash-escaped digits (\1 to \9) can be used to insert text matching corre- sponding parenthesized group from the pattern. |
str | [in] The string to match. If this is nullptr, returns tFalse. |
tBool PartialMatch | ( | const cStringPiece & | text, |
const cRegularExpressionArg & | ptr1 = oNoArg , |
||
const cRegularExpressionArg & | ptr2 = oNoArg , |
||
const cRegularExpressionArg & | ptr3 = oNoArg , |
||
const cRegularExpressionArg & | ptr4 = oNoArg , |
||
const cRegularExpressionArg & | ptr5 = oNoArg , |
||
const cRegularExpressionArg & | ptr6 = oNoArg , |
||
const cRegularExpressionArg & | ptr7 = oNoArg , |
||
const cRegularExpressionArg & | ptr8 = oNoArg , |
||
const cRegularExpressionArg & | ptr9 = oNoArg , |
||
const cRegularExpressionArg & | ptr10 = oNoArg , |
||
const cRegularExpressionArg & | ptr11 = oNoArg , |
||
const cRegularExpressionArg & | ptr12 = oNoArg , |
||
const cRegularExpressionArg & | ptr13 = oNoArg , |
||
const cRegularExpressionArg & | ptr14 = oNoArg , |
||
const cRegularExpressionArg & | ptr15 = oNoArg , |
||
const cRegularExpressionArg & | ptr16 = oNoArg |
||
) | const |
Checks if any substring matches.
text | [in] The string to match. |
ptr1 | [inout] The capturing argument 1. |
ptr2 | [inout] The capturing argument 2. |
ptr3 | [inout] The capturing argument 3. |
ptr4 | [inout] The capturing argument 4. |
ptr5 | [inout] The capturing argument 5. |
ptr6 | [inout] The capturing argument 6. |
ptr7 | [inout] The capturing argument 7. |
ptr8 | [inout] The capturing argument 8. |
ptr9 | [inout] The capturing argument 9. |
ptr10 | [inout] The capturing argument 10. |
ptr11 | [inout] The capturing argument 11. |
ptr12 | [inout] The capturing argument 12. |
ptr13 | [inout] The capturing argument 13. |
ptr14 | [inout] The capturing argument 14. |
ptr15 | [inout] The capturing argument 15. |
ptr16 | [inout] The capturing argument 16. |
tBool Replace | ( | const cStringPiece & | rewrite, |
cString * | str | ||
) | const |
Replaces the first match of str with rewrite.
rewrite | [in] The replacement. Backslash-escaped digits (\1 to \9) can be used to insert text matching corre- sponding parenthesized group from the pattern. |
str | [in] The string to match. |
Sets the regular expression string.
strExpression | [in] The regular expression string. |
bCaseSensitive | [in] Whether or not the match is case sensitive. |