Created
August 19, 2010 19:09
-
-
Save hiddentrak/538635 to your computer and use it in GitHub Desktop.
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
//regex that finds and replaces tokens in a string | |
public function replaceTokens(str : String,paramObj : Object) : String { | |
//token structure ${tokenName} | |
var myRegEx : RegExp = /\$\{([a-zA-Z0-9]+)\}/g; | |
return str.replace(myRegEx, function():String { | |
return (paramObj[arguments[1]]) ? paramObj[arguments[1]] : ""; | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment