Skip to content

Instantly share code, notes, and snippets.

@GiancarloGomez
Last active September 11, 2016 14:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GiancarloGomez/cd59c68cb56647361c458f4cce0ac8b4 to your computer and use it in GitHub Desktop.
Save GiancarloGomez/cd59c68cb56647361c458f4cce0ac8b4 to your computer and use it in GitHub Desktop.
Simple function that cleans emoji's from a string using Java's String replaceAll() function. Previous to this the solution used was => https://gist.github.com/GiancarloGomez/0e76348c89df8f3b72fddfe7843cbceb (http://www.giancarlogomez.com/2016/09/emoji-support-with-coldfusion-and-mysql.html)
public string function cleanEmojiWithColdFusion(required string value){
// Match Emoticons
var regexEmoticons = "[\x{1F600}-\x{1F64F}]";
// Match Miscellaneous Symbols and Pictographs
var regexSymbols = "[\x{1F300}-\x{1F5FF}]";
// Match Transport And Map Symbols
var regexTransport = "[\x{1F680}-\x{1F6FF}]";
// Return cleaned and trimmed string
return arguments.value
.replaceAll(regexEmoticons,"")
.replaceAll(regexSymbols,"")
.replaceAll(regexTransport,"")
.trim();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment