Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
def findMatchingPatterns(regexes: ArrayList[String]): UserDefinedFunction = {
udf((value: String) => {
for {
text <- Option(value)
matches = regexes.asScala.filter(r => Pattern.matches(r, text))
if matches.nonEmpty
} yield matches
}, ArrayType(StringType))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.