Objective-C Regex Categories

MIT License
Objective-C
iOS

1 image

Author

Description

This project is a collection of objective-c categories for NSRegularExpression and NSString that make usage easier and more concise.

//Using NSRegularExpression
NSString* string = @"I have 2 dogs.";
NSRegularExpression *regex = [NSRegularExpression
    regularExpressionWithPattern:@"\\d+"
    options:NSRegularExpressionCaseInsensitive
    error:&error];

NSTextCheckingResult *match = [regex firstMatchInString:string
     options:0
     range:NSMakeRange(0, [string length])];

BOOL isMatch = match != nil;

// Using this library
BOOL isMatch = [@"I have 2 dogs." isMatch:RX(@"\\d+")];

.

Learn more at: https://github.com/bendytree/Objective-C-RegEx-Categories

Tags

Sponsored with ❤️ by Instabug

Instabug: Understand how your app is doing with real-time contextual insights from your users

Get all the logs you need and fix bugs, crashes, and other issues in minutes instead of days. With Instabug you will automatically receive device data, network logs, and reproduction steps with every bug and crash report. It only takes a line of code to integrate and is perfect for teams that are now working remotely. See more detailed features comparison and try Instabug for free here.

Get Started Now