Git Product home page Git Product logo

vrxverbalexpressions's Introduction

VRXVerbalExpressions

An Objective-C implementation of VerbalExpressions

Installation

For now, just add VRXVerbalExpressions.h and VRXVerbalExpressions.m files to your project.

(CocoaPods coming soon)

Examples

Testing if we have a valid URL

//
// There are two ways of creating VRXExpressions. Either through
// a block based API:
//
id exp = [VRXVerbalExpression create:^(VRXVerbalExpression *r) {
        [r startOfLine];
        [r then:@"http"];
        [r maybe:@"s"];
        [r then:@"://"];
        [r maybe:@"www."];
        [r anythingBut:@" "];
        [r endOfLine];
}];

// 
// or a messages based API can be used:
// Note that startOfLine is both an instance and class method, 
// facilitating both methods of creating expressions
//
id exp = [[[[[[[VRXVerbalExpression startOfLine]
                   then:@"http"]
                  maybe:@"s"]
                 then:@"://"]
                maybe:@"www."]
               anythingBut:@" "]
              endOfLine];

//
// Once a VRXVerbalExpression has been created (id was used
// above for brevity), it can be tested for matches:
//
BOOL test = [exp test:@"https://www.google.com"];

Developer setup : running the tests

The tests use NSUnit, there is a Podfile included that will setup NSUnit for you. Just run Pod install in the VRXVerbalExpressions directory.

vrxverbalexpressions's People

Contributors

jacksonh avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.