Closed takao-yoshida closed 2 months ago
Thank you for letting me know about this issue. I will be releasing a fix today. It will probably take Redcap a while to approve the new release as the REDCap Conference is next week and I'm not sure if they will be reviewing changes. You can obviously manually install the release if you like.
Just pushed the fix. I've included an example unicode regex that I used for testing. If you'd like to open a PR to share your Regex for Japanese Hiragana, please do. I'll be closing this ticket, feel free to comment if you have any questions or issues.
Hi @aanunez
I am happy to find this external module. Thanks for publishing a great module. However, I found that there are problems when dealing with multi-byte characters. The /u flag is required for regular expressions to handle multibyte characters correctly. The /u flag unfortunately is not handled properly in v1.1.3.
Here are the steps I have confirmed:
1.I have prepared the following set and added in repo.php:
[ "display" => "Japanese Hiragana only", "internal" => "jp_hiragana", "phpRegex" => "/^[ぁ-んー゛゜ゝゞ]+$/u", "jsRegex" => "/^[ぁ-んー゛゜ゝゞ]+$/", "dataType" => "text", "examples" => ["みずようかん"], "notes" => "ひらがなのみ。(あ〜ん、濁音、破擦音、長音記号、小文字の全角ひらがなも含む)" ],
2.I checked the Regex Repo page.
Japanese Hiragana only jp_hiragana /^[ぁ-んー゛゜ゝゞ]+$/u
3.I clicked the Add button. 4.The following was displayed in the PHP Regex field:
[ぁ-んー゛゜ゝゞ]+$
5.I clicked the Add button. 6.When I checked with the database query tool, there were two $'s and the /u flag was missing.
/^[ぁ-んー゛゜ゝゞ]+$$/
The /u flag used in PHP regular expressions is to process the pattern and target string as UTF-8. By adding this, multibyte characters (such as Japanese) can be handled correctly.
I really hope that a new version of the module will be released that fixes this behavior. Thank you for advance,