Latest 0.1.2
License MIT
Platforms ios 4.0, osx 10.7, requires ARC


Build Status
Coverage Status

Objective-C Regular Expressions made easy

ObjectiveCVerbalExpressions is a Objective-C library that helps to construct difficult regular expressions – ported from the awesome JavaScript VerbalExpressions.


From Cocoapods

pod 'VEVerbalExpressions'

From source

Drags VerbalExpressions.h and VerbalExpressions.m into your projects and import "VerbalExpressions.h"


Here’s a couple of simple examples to give an idea of how VerbalExpressions works:

Testing if we have a valid URL

// Create an example of how to test for correctly formed URLs
VerbalExpressions *tester = VerEx()
.anythingBut(@" ")

// Create an example URL
NSString *testMe = @"";

// Use test() method
if (tester.test(testMe)) {
    NSLog(@"%@", @"We have a correct URL"); // This output will fire
} else {
    NSLog(@"%@", @"The URL is incorrect");

NSLog(@"%@", tester); // Ouputs the actual expression used: "^(http)(s)?(:�_/�_/)(www)?([^ ]*)$"

Replacing strings

NSString *replaceMe = @"Replace bird with a duck";

// Create an expression that seeks for word "bird"
VerbalExpressions *verEx = VerEx().find(@"bird");

// Execute the expression like a normal RegExp object
NSString *result = verEx.replace(replaceMe, @"duck" );

NSLog(@"%@", result); // Outputs "Replace duck with a duck"

Shorthand for string replace:

NSString *result2 = VerEx().find(@"red").replace(@"We have a red house", @"blue");

NSLog(@"%@", result2); // Outputs "We have a blue house"

API documentation

I haven’t added much documentation to this repo yet, but you can find the documentation for the original JavaScript repo on their wiki. Most of the methods have been ported as of v0.1.0 of the JavaScript repo. Just be sure to use the syntax explained above rather than the dot notation :)


Clone the repo and fork!
Pull requests are warmly welcomed!


  • I haven’t yet ported the stopAtFirst method.


Thank you to @jehna for coming up with the awesome original idea!

Other implementations

You can view all implementations on

Latest podspec

    "name": "VEVerbalExpressions",
    "version": "0.1.2",
    "summary": "Objective-C Regular Expressions made easy",
    "homepage": "",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    "authors": {
        "kishikawakatsumi": "[email protected]"
    "source": {
        "git": "",
        "tag": "v0.1.2"
    "platforms": {
        "ios": "4.0",
        "osx": "10.7"
    "source_files": "Lib/*",
    "requires_arc": true

Pin It on Pinterest

Share This