Ported from VerbalExpressions
VerbalExpressionsForObjC is a Objective C class that helps to construct hard regular expressions.
VerbalExpressions *verex = VerEx()
.searchOneLine(YES)
.startOfLine()
.then( @"http" )
.maybe( @"s" )
.then( @"://" )
.maybe( @"www." )
.anythingBut( @" " )
.endOfLine();
XCTAssertTrue([verex test:@"https://mail.google.com"], @"not a valid url");
NSString *result = VerEx().find(@"google").replace(@"http://www.google.com",@"yahoo");
XCTAssertTrue([result isEqualToString:@"http://www.yahoo.com"], @"cannot find the text to replace");
You can see an up to date list of all ports in our organization.