Skip to content

Instantly share code, notes, and snippets.

@dvdantunes
Forked from terrancesnyder/regex-japanese.txt
Last active November 14, 2023 02:22
Show Gist options
  • Select an option

  • Save dvdantunes/f58baff56d45a53dbe4c0a22a72624e7 to your computer and use it in GitHub Desktop.

Select an option

Save dvdantunes/f58baff56d45a53dbe4c0a22a72624e7 to your computer and use it in GitHub Desktop.

Revisions

  1. dvdantunes revised this gist Nov 14, 2023. 1 changed file with 7 additions and 7 deletions.
    14 changes: 7 additions & 7 deletions regex-japanese.md
    Original file line number Diff line number Diff line change
    @@ -2,21 +2,21 @@

    ## Reference

    - [Japanese Regex Alzheimers – Why Cant I Remember?](https://gist.github.com/terrancesnyder/1345094)
    - [そのまま使える正規表現集 for regExp (javascript)](https://web.archive.org/web/20120507130321/http://befine.jugem.jp/?eid=29)
    - [Japanese Regex Alzheimers – Why Can't I Remember? - crunchytoast.com](https://web.archive.org/web/20120422073323/http://crunchytoast.com/2009/12/12/japanese-regex-alzheimers-and-why-cant-i-remember/)
    - [そのまま使える正規表現集 for regExp (javascript) - 素人ときどき玄人](https://web.archive.org/web/20120507130321/http://befine.jugem.jp/?eid=29)
    - [Gist - terrancesnyder/regex-japanese.txt](https://gist.github.com/terrancesnyder/1345094)

    <br>

    ## From "Japanese Regex Alzheimers – Why Cant I Remember?"
    ## From "Japanese Regex Alzheimers – Why Can't I Remember?"

    URL: [On wayback machine](https://web.archive.org/web/20120422073323/http://crunchytoast.com/2009/12/12/japanese-regex-alzheimers-and-why-cant-i-remember/)


    | Match | Regex |
    | :--- | :--- |
    | ALL Japanese common & uncommon Kanji (4e00 – 9fcf) ~ The Big Kahuna! | `([一-龯])` |
    | Hiragana or Katakana | `([ぁ-んァ-ン])` |
    | Match | Example | Regex |
    | :--- | :--- | :--- |
    | ALL Japanese common & uncommon Kanji (4e00 – 9fcf) ~ The Big Kahuna! | `` | `([一-龯])` |
    | Hiragana or Katakana | `` | `([ぁ-んァ-ン])` |
    | non-Hiragana or non-Katakana | `([^ぁ-んァ-ン])` |
    | Hiragana or Katakana or basic punctuation (、。’) | `([ぁ-んァ-ン\w])` |

  2. dvdantunes renamed this gist Nov 14, 2023. 1 changed file with 21 additions and 7 deletions.
    28 changes: 21 additions & 7 deletions regex-japanese.txt → regex-japanese.md
    Original file line number Diff line number Diff line change
    @@ -1,11 +1,24 @@
    Regex for matching ALL Japanese common & uncommon Kanji (4e00 – 9fcf) ~ The Big Kahuna!
    ([一-龯])
    # Regex Japanese

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

    Regex for matching Non-Hirgana or Non-Katakana
    ([^ぁ-んァ-ン])
    - [Japanese Regex Alzheimers – Why Can’t I Remember?](https://gist.github.com/terrancesnyder/1345094)
    - [そのまま使える正規表現集 for regExp (javascript)](https://web.archive.org/web/20120507130321/http://befine.jugem.jp/?eid=29)
    - [Gist - terrancesnyder/regex-japanese.txt](https://gist.github.com/terrancesnyder/1345094)

    <br>

    ## From "Japanese Regex Alzheimers – Why Can’t I Remember?"

    URL: [On wayback machine](https://web.archive.org/web/20120422073323/http://crunchytoast.com/2009/12/12/japanese-regex-alzheimers-and-why-cant-i-remember/)


    | Match | Regex |
    | :--- | :--- |
    | ALL Japanese common & uncommon Kanji (4e00 – 9fcf) ~ The Big Kahuna! | `([一-龯])` |
    | Hiragana or Katakana | `([ぁ-んァ-ン])` |
    | non-Hiragana or non-Katakana | `([^ぁ-んァ-ン])` |
    | Hiragana or Katakana or basic punctuation (、。’) | `([ぁ-んァ-ン\w])` |

    Regex for matching Hirgana or Katakana or basic punctuation (、。’)
    ([ぁ-んァ-ン\w])
    @@ -47,4 +60,5 @@ 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}$/

  3. @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}$/