Skip to content

Instantly share code, notes, and snippets.

@swaroopjcse
Created September 18, 2015 00:04
Show Gist options
  • Save swaroopjcse/725e3856dadabea0bc3a to your computer and use it in GitHub Desktop.
Save swaroopjcse/725e3856dadabea0bc3a to your computer and use it in GitHub Desktop.
Nice shorthand to match RegEx in Swift; courtesy http://www.benscheirman.com/2014/06/regex-in-swift/
if let _ = password.rangeOfString("(some-regex)", options: .RegularExpressionSearch) {
// RegEx matches
} else {
// RegEx does not match
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment