Created
July 10, 2020 06:17
-
-
Save ann-kilzer/227f84cfc906f44dc2279999074c954b to your computer and use it in GitHub Desktop.
Custom Vuelidate for checking Japanese
This file contains hidden or 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
// custom vuelidate validator to ensure input is Japanese | |
// inspired by https://stackoverflow.com/questions/15033196/using-javascript-to-check-whether-a-string-contains-japanese-characters-includi | |
const japanese = (value) => { | |
const jaRegex = /^[\u3000-\u303f\u3040-\u309f\u30a0-\u30ff\uff00-\uff9f\u4e00-\u9faf\u3400-\u4dbf]*$/; | |
return jaRegex.test(value); | |
}; | |
export default japanese; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment