* @brief Initializes PCRE pattern by providing the subject and replacement strings. * @param pattern PCRE pattern, a string containing PCRE patterns, capturing groups. * @param replacement PCRE replacement, a string where $0 ... $9 will be replaced with the corresponding capturing groups * @return true if successful, false if failure */
| 47 | * @return true if successful, false if failure |
| 48 | */ |
| 49 | bool |
| 50 | Pattern::init(const String &pattern, const String &replacement) |
| 51 | { |
| 52 | pcreFree(); |
| 53 | |
| 54 | _pattern.assign(pattern); |
| 55 | _replacement.assign(replacement); |
| 56 | |
| 57 | _tokenCount = 0; |
| 58 | |
| 59 | if (!compile()) { |
| 60 | PrefetchDebug("failed to initialize pattern:'%s', replacement:'%s'", pattern.c_str(), replacement.c_str()); |
| 61 | pcreFree(); |
| 62 | return false; |
| 63 | } |
| 64 | |
| 65 | return true; |
| 66 | } |
| 67 | |
| 68 | /** |
| 69 | * @brief Initializes PCRE pattern by providing the pattern only or pattern+replacement in a single configuration string. |
nothing calls this directly
no test coverage detected