Skip to content

Instantly share code, notes, and snippets.

@JamoCA
Last active March 8, 2024 01:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JamoCA/7011433 to your computer and use it in GitHub Desktop.
Save JamoCA/7011433 to your computer and use it in GitHub Desktop.
This is a ColdFusion UDF to determine if a text string contains any Cyrillic characters. (Returns boolean Yes/No.) The ColdFusion 9 & 10 Regex function doesn't support UTF, so you need to access Java in order to do it.
<cfscript>
function isCyrillic(input){
return javaCast("string", input).matches("(.*)[\u0400-\u04FF](.*)");
/* Prior method that was used. Slower.
return createObject("java", "java.util.regex.Pattern").compile(javaCast("string", "[\u0400-\u04FF]")).matcher(javaCast("string", input)).find();
*/
}
</cfscript>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment