Releases: samkrishna/RegexKitX
RegexKitX Version 6.0
Version 6.0 diverges substantially from Version 5.0 in terms of API.
NOTE: IF YOU NEED A PURE RegexKitLite 4.0 REPLACEMENT, USE VERSION 5.0.
Objective-C Changes include:
- Added ability to match named capture groups (macOS 10.13 or later)
- Added capacity to make template substitutions based on named capture groups (macOS 10.13 or later)
- Renamed multiple API clusters to be semantically more regex context-correct
- Modernized the block syntax
- Deprecated the "captureCount" argument in all block-based methods
- Replaced all C arrays with NSArrays in all block-based methods
- Added generics to all collection references inside the APIs
- If using RKXReportProgress as a match option, a timeout error will now be returned if a regex fails to match within 1.0 seconds
- Tons of new examples in the test cases
A number of APIs were using an NSArray-inspired convention for naming semantics. While it was a familiar convention, I felt like the convention failed to convey a regex-sensitive context in the RKL4 APIs, hence the need for a large-scale API renaming effort.
RegexKitLite 5.0 Migration
This first release includes an almost pure clone of the the RegexKitLite 4.0 ("RKL4") Objective-C API from John Engelhart. This version includes:
- Exposing
NSMatchingOptions
on the most argument-rich API call (not required to be used) - Use of
NSNotFound
as the error return code if an API returningNSUInteger
doesn't match the regex - Use of proper
NSArray
collections for the block-based methods - All code is ARC-compliant
- The Objective-C API is 100% Analyzer Approved!!
- Cursory tests demonstrating how to use each of the APIs
- Deprecated
RKLRegexEnumerationOptions
- Deprecated all the
RKLICURegex...Error
keys
NOTE: If you use any of the block-based methods from RKL4, you'll need to update your code at the block signature level. Specifically, you'll need to convert the RKL4 API blocks from this kind of block signature:
- (BOOL)enumerateStringsMatchedByRegex:(NSString *)regex
usingBlock:(void (^)(NSInteger captureCount, NSString * const capturedStrings[captureCount], const NSRange capturedRanges[captureCount], volatile BOOL * const stop))block;
to this kind of block signature:
- (BOOL)enumerateStringsMatchedByRegex:(NSString *)pattern
usingBlock:(void (^)(NSArray<NSString *> *capturedStrings, NSArray<NSValue *> *capturedRanges, BOOL *stop))block;
It's a small conversion to NSUInteger
and NSArray
for the captureCount
and capturedStrings
block arguments.