Created
October 12, 2014 18:45
-
-
Save ghidalgo3/97fe0b2bf33b7e30f0ac to your computer and use it in GitHub Desktop.
What should this do?
This file contains 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
/** @return string with all occurrences of regex replaced with the paired string returned by supplying the match generated by the regex. Ensures recursive replacements cannot occur. */ | |
def findRegexReplaceMatch( | |
s: String, | |
zomRegex: Seq[(Regex, Match => String)] | |
) : String = { | |
var t = s | |
for((regex, matchingFunc) <- zomRegex) { | |
t = regex.replaceAllIn(t, matchingFunc) | |
} | |
t | |
/*zomRegex.map{ | |
case (regex, matcher) => | |
regex.replaceAllIn(s, matcher) | |
}.mkString*/ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment