Skip to content

Instantly share code, notes, and snippets.

@aodhol
Last active July 28, 2016 14:49
Show Gist options
  • Save aodhol/590582945800f55b8d88466258904573 to your computer and use it in GitHub Desktop.
Save aodhol/590582945800f55b8d88466258904573 to your computer and use it in GitHub Desktop.
// Returns true if array contains a String matching the specified regular expression pattern
extension SequenceType where Generator.Element == String {
func matches(pattern: String) -> Bool {
for item in self {
if (item.rangeOfString(pattern, options: .RegularExpressionSearch) != nil) {
return true
}
}
return false
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment