Latest 0.2.5
Homepage https://github.com/yhkaplan/Reg
License MIT
Platforms ios 10.0, osx 10.13
Frameworks Foundation
Authors

Reg is a friendly wrapper for NSRegularExpression

TLDR

Turn this:

let range = NSRange(location: 0, length: string.utf16.count)
let regex = try? NSRegularExpression(pattern: "^gummy bears have no cares")
let str = "gummy bears have no cares"
let firstMatch = regexs?.firstMatch(in: str, options: [], range: range)
let matchRange = Range(firstMatch.range, in: str)

let matchStr = String(str[matchRange])

into this:

let str = "gummy bears have no cares"
let matchStr = "^gummy bears have no cares".firstMatch(in: str)

Features

matches

hasMatch

firstMatch

Operators

=~

!~

Latest podspec

{
    "name": "Reg",
    "version": "0.2.5",
    "summary": "A convenient Ruby-like wrapper for NSRegularExpression",
    "homepage": "https://github.com/yhkaplan/Reg",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "Joshua Kaplan": "[email protected]"
    },
    "source": {
        "git": "https://github.com/yhkaplan/Reg.git",
        "tag": "0.2.5"
    },
    "social_media_url": "https://twitter.com/yhkaplan",
    "source_files": "Sources/Reg/*.{swift,h,m}",
    "frameworks": "Foundation",
    "platforms": {
        "ios": "10.0",
        "osx": "10.13"
    }
}

Pin It on Pinterest

Share This