|
pure virtual |
Replaces the first matching subexpressions in the pSearch string with a replacement string provided as the resultof a callback function.
Replaces all occurrances if the MODIFIER_GLOBAL flag is passed in the "modifiers" paramater. Places the resulting string in the pResult buffer passed in by the caller. Note, that the 'compile' function must be called before this function. If the component was created with the trace option then the evalution steps will be detailed logged.
The benefit of this function is that the replacement string is not fixed but provided by the calling application via a callback function and can be different for each subexpression match.
Meaningful modifiers: { P6MODIFIER_INSENSITIVE, P6MODIFIER_FASTGREEDY, P6MODIFIER_MULTILINE, P6MODIFIER_GLOBAL }
pSearch | [ in ] The string to test against the compiled regular expression. |
modifiers | [ in ] A bit mask that defines how the regex engine performs the match |
pfn | [ in ] Pointer to a callback function to be invoked each time a match is found in the pSearch parameter. The callback function returns the string to replace the matched subexpression with. This string can have back references in it (e.g., "--\1--\2"). The back references are evaluated after each match for global matches. |
pCtx | [ in ] Can be NULL, pointer to a context that is passed to the pfn callback each time to get the replacement string from the application. This memory is allocated and freed only by the caller. |
pResult | [ out ] The final result string with all replacements done. |
Success | P6R::eOk | |
Failure | P6R::eNotInitialized | A successful call to initialize was not made before this call. |
P6R::eInvalidArg | One or more of pSearch, pReplace, and pSize is set to NULL. | |
P6R::eAccessFault | The compile function has not be successfully called. | |
P6R::eNoMemory | Insufficent memory to process the regex. |