pythonの正規表現で機種依存文字のチェック.
先頭に機種依存文字が来るとマッチするが日本語の後に機種依存文字が来るとマッチしないのはバグ?
code:python
$ ipython
Python 3.11.0rc1 (main, Aug 12 2022, 10:02:14) GCC 11.2.0 Type 'copyright', 'credits' or 'license' for more information
IPython 8.16.1 -- An enhanced Interactive Python. Type '?' for help.
In 3: re.match(regex_pattern, "こんにちは") In 4: re.match(regex_pattern, "こんにちは ①") In 5: print(re.match(regex_pattern, "こんにちは ①")) None
In 6: print(re.match(regex_pattern, "①")) <re.Match object; span=(0, 1), match='①'>
In 7: print(re.match(regex_pattern, "こんにちは ① ")) None
In 8: print(re.match(regex_pattern, "① ")) <re.Match object; span=(0, 1), match='①'>
In 9: print(re.match(regex_pattern, "① aaaa")) <re.Match object; span=(0, 1), match='①'>
In 10: print(re.match(regex_pattern, "① あああaaaa")) <re.Match object; span=(0, 1), match='①'>
In 11: print(re.match(regex_pattern, "あああ①")) None