Last active
July 28, 2016 14:49
-
-
Save aodhol/590582945800f55b8d88466258904573 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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