Matches one or more hiragana and katakana characters - Node.js String

Node.js examples for String:Char

Description

Matches one or more hiragana and katakana characters

Demo Code

String.prototype.isHiragana = function(){
  return !!this.match(/^[\u3040-\u3096]+$/);
}

// matches one or more full-width katakana characters
String.prototype.isKatakana = function(){
  return !!this.match(/^[\u30A1-\u30FA|\u30FC|\u3001-\u302F|\uFF5B|\uFF5D|\uFF08|\uFF09|\uFF3B|\uFF3D|\u2026|\u2025]+$/);
}

String.prototype.isPureKatakana = function(){
  return !!this.match(/^[\u30A1-\u30FA]+$/);
}

Related Tutorials