Skip to content

Instantly share code, notes, and snippets.

@mvn-huyenle-hn
Forked from terrancesnyder/regex-japanese.txt
Last active December 8, 2021 03:06
Show Gist options
  • Save mvn-huyenle-hn/f4c38672a30cb675a5812e8f6c3c33d0 to your computer and use it in GitHub Desktop.
Save mvn-huyenle-hn/f4c38672a30cb675a5812e8f6c3c33d0 to your computer and use it in GitHub Desktop.

Revisions

  1. mvn-huyenle-hn revised this gist Dec 8, 2021. No changes.
  2. mvn-huyenle-hn revised this gist Dec 20, 2019. 1 changed file with 2 additions and 4 deletions.
    6 changes: 2 additions & 4 deletions regex-japanese.txt
    Original file line number Diff line number Diff line change
    @@ -51,7 +51,5 @@ Regex for matching Japanese fixed line phone numbers


    =================================================
    'katakana' => array(
    'rule' => '/^([ァ-ヶー]+[\s| ]?)*[ァ-ヶー]+$/u',
    'message' => '口座名カナ(フリガナ)で入力してください'
    ),
    'katakana':
    '/^([ァ-ヶー]+[\s| ]?)*[ァ-ヶー]+$/u'
  3. mvn-huyenle-hn revised this gist Dec 20, 2019. 1 changed file with 8 additions and 1 deletion.
    9 changes: 8 additions & 1 deletion regex-japanese.txt
    Original file line number Diff line number Diff line change
    @@ -47,4 +47,11 @@ Regex for matching Japanese mobile phone numbers (keitai bangou)

    Regex for matching Japanese fixed line phone numbers
    /^[0-9-]{6,9}$|^[0-9-]{12}$/
    /^¥d{1,4}-¥d{4}$|^¥d{2,5}-¥d{1,4}-¥d{4}$/
    /^¥d{1,4}-¥d{4}$|^¥d{2,5}-¥d{1,4}-¥d{4}$/


    =================================================
    'katakana' => array(
    'rule' => '/^([ァ-ヶー]+[\s| ]?)*[ァ-ヶー]+$/u',
    'message' => '口座名カナ(フリガナ)で入力してください'
    ),
  4. @terrancesnyder terrancesnyder created this gist Nov 7, 2011.
    50 changes: 50 additions & 0 deletions regex-japanese.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,50 @@
    Regex for matching ALL Japanese common & uncommon Kanji (4e00 – 9fcf) ~ The Big Kahuna!
    ([一-龯])

    Regex for matching Hirgana or Katakana
    ([ぁ-んァ-ン])

    Regex for matching Non-Hirgana or Non-Katakana
    ([^ぁ-んァ-ン])

    Regex for matching Hirgana or Katakana or basic punctuation (、。’)
    ([ぁ-んァ-ン\w])

    Regex for matching Hirgana or Katakana and random other characters
    ([ぁ-んァ-ン!:/])

    Regex for matching Hirgana
    ([ぁ-ん])

    Regex for matching full-width Katakana (zenkaku 全角)
    ([ァ-ン])

    Regex for matching half-width Katakana (hankaku 半角)
    ([ァ-ン゙゚])

    Regex for matching full-width Numbers (zenkaku 全角)
    ([0-9])

    Regex for matching full-width Letters (zenkaku 全角)
    ([A-z])

    Regex for matching Hiragana codespace characters (includes non phonetic characters)
    ([ぁ-ゞ])

    Regex for matching full-width (zenkaku) Katakana codespace characters (includes non phonetic characters)
    ([ァ-ヶ])

    Regex for matching half-width (hankaku) Katakana codespace characters (this is an old character set so the order is inconsistent with the hiragana)
    ([ヲ-゚])

    Regex for matching Japanese Post Codes
    /^¥d{3}¥-¥d{4}$/
    /^¥d{3}-¥d{4}$|^¥d{3}-¥d{2}$|^¥d{3}$/

    Regex for matching Japanese mobile phone numbers (keitai bangou)
    /^¥d{3}-¥d{4}-¥d{4}$|^¥d{11}$/
    /^0¥d0-¥d{4}-¥d{4}$/

    Regex for matching Japanese fixed line phone numbers
    /^[0-9-]{6,9}$|^[0-9-]{12}$/
    /^¥d{1,4}-¥d{4}$|^¥d{2,5}-¥d{1,4}-¥d{4}$/