Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jacksonh/VRXVerbalExpressions
An Objective-C implementation of Verbal Expressions
https://github.com/jacksonh/VRXVerbalExpressions
Last synced: about 1 month ago
JSON representation
An Objective-C implementation of Verbal Expressions
- Host: GitHub
- URL: https://github.com/jacksonh/VRXVerbalExpressions
- Owner: jacksonh
- License: mit
- Created: 2013-08-10T03:16:41.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2014-07-02T18:32:43.000Z (over 10 years ago)
- Last Synced: 2024-04-14T19:41:39.103Z (8 months ago)
- Language: Objective-C
- Size: 136 KB
- Stars: 136
- Watchers: 5
- Forks: 11
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome - VRXVerbalExpressions - An Objective-C implementation of Verbal Expressions (etc)
- awesome - VRXVerbalExpressions - An Objective-C implementation of Verbal Expressions (etc)
README
VRXVerbalExpressions
====================An Objective-C implementation of [VerbalExpressions](https://github.com/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
```Objective-C//
// 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](https://github.com/jacksonh/NSUnit), there is a Podfile included that will setup NSUnit for you. Just run `Pod install` in the VRXVerbalExpressions directory.