Last active
June 16, 2019 06:01
-
-
Save xtetsuji/bfbc360e0c5c714c8754b35b5b5504e0 to your computer and use it in GitHub Desktop.
match regular expression of 1..99 kanji numerals
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/perl | |
use strict; | |
use warnings; | |
use utf8; | |
# 漢数字 1..9 の一文字 (need: use utf8) | |
my $kd_re = qr/[一二三四五六七八九]/; | |
# 1..99 の漢数字表現 | |
my $kanji_numerals_re = qr{ | |
$kd_re # 一桁 | |
| | |
$kd_re? (?<!一)十 $kd_re? # 二桁で「十」を伴う場合 | |
| | |
$kd_re (?:$kd_re|〇) # 二桁で「十」を伴わない場合 | |
}x; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment