Regular Expressions 101

Community Patterns

Japanese Characters matching

1

Regular Expression
ECMAScript (JavaScript)

/
[aeiou]|[kstpgzdnhpmr][aeiou]|(?:sh|ch|j|ts|f|y|w)(?:y[auo]|[aeiou])|nn|([a-z])\1
/
gm

Description

Regex for Matching Jap Romaji Chars.

I am in the middle of making an interface for Anki that works life wanikani. This way I can practice my own cards instead of a set syllabus.

For that I need to make a Japanese Kana input, so I went with the good old regex to match all the romaji groups which can be replaced with the hiragana or katakana characters.

  • Simple grouping of the basic set
  • Need to make it for complex groups like Chyu and Cho

Also I'll assign a key to switch dakuten (ほ → ぼ)in JS.

Submitted by Aashay Thakur - 2 years ago (Last modified 2 years ago)