bryancall opened a new pull request, #12607:
URL: https://github.com/apache/trafficserver/pull/12607

   ## Summary
   This PR converts the cachekey plugin from using the old PCRE library 
directly to using the modern `ts::Regex` class which wraps PCRE2.
   
   ## Changes
   - Replace direct PCRE usage with `ts::Regex` class
   - Update Pattern class to use `Regex::compile()` and `Regex::exec()`
   - Use `RegexMatches` for capture group handling
   - Use `RE_ERROR_NOMATCH` from `tsutil/Regex.h`
   - Add comprehensive error checking in `match()`, `capture()`, and 
`replace()` methods
   - Use default parameter values (cleaner code)
   
   ## Benefits
   - **Modern PCRE2 API**: Better performance and features
   - **JIT compilation**: Automatic optimization
   - **Better error handling**: Detailed error messages with error codes
   - **RAII resource management**: No manual memory management needed
   - **Thread-safe execution**: Safe concurrent regex operations
   
   ## Testing
   - **Comprehensive test suite**: 141 assertions across 4 test cases (up from 
33)
   - **New test coverage**:
     - Config string parsing (`/pattern/replacement/` format)
     - Multiple replacement patterns and edge cases
     - `process()` method for both capture and replace modes
     - `MultiPattern` class with priority matching
     - `NonMatchingMultiPattern` exclusion logic
     - `Classifier` for User-Agent device detection
   - **Backward compatibility verified**: All tests pass on both old PCRE and 
new PCRE2 implementations
   - All existing functionality preserved
   
   ## Files Changed
   - `plugins/cachekey/pattern.h`: Updated to use `Regex` class
   - `plugins/cachekey/pattern.cc`: Converted from PCRE to PCRE2/Regex
   - `plugins/cachekey/unit_tests/pattern_test.cc`: Added comprehensive tests
   
   ## Related
   - Depends on #12606 (Expose PCRE2 error codes in tsutils Regex.h API)


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to