Skip to content

Instantly share code, notes, and snippets.

@ann-kilzer
Created July 10, 2020 06:17
Show Gist options
  • Save ann-kilzer/227f84cfc906f44dc2279999074c954b to your computer and use it in GitHub Desktop.
Save ann-kilzer/227f84cfc906f44dc2279999074c954b to your computer and use it in GitHub Desktop.
Custom Vuelidate for checking Japanese
// 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