Last active
March 8, 2024 01:37
-
-
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.
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
<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