Skip to content

Instantly share code, notes, and snippets.

@KentarouKanno
Created February 6, 2019 02:03
Show Gist options
  • Save KentarouKanno/8badf40f37fdcaced9ce4a5d0806cc66 to your computer and use it in GitHub Desktop.
Save KentarouKanno/8badf40f37fdcaced9ce4a5d0806cc66 to your computer and use it in GitHub Desktop.
struct Regexp {
    let pattern: String
    static func ~= (regexp: Regexp, targetString: String) -> Bool {
        return targetString.range(of: regexp.pattern, options: .regularExpression) != nil
    }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment