[CUBBY-62] FileRegexpValidatorとRegexpValidatorでマッチフラグ対応 Created: 2008-01-11 Updated: 2008-01-12 Resolved: 2008-01-12 |
|
Status: | Closed |
Project: | Cubby |
Component/s: | Core, Examples |
Affects Version/s: | 0.9.2 |
Fix Version/s: | 1.0.0-RC1 |
Type: | Improvement | Priority: | Major |
Reporter: | jfut | Assignee: | agata |
Resolution: | Fixed | Votes: | 0 |
Labels: | None |
Description |
FileUploadActionの例にある add("file", new FileRegexpValidator(".+\\.(png|jpg)")); だと hoge.PNG や hoge.JPG など小文字以外が通らないので、Examplesとしては、 add("file", new FileRegexpValidator(".+\\.(?i)(png|jpg)")); add("file", new FileRegexpValidator(".+\\.(png|PNG|jpg|JPG)")); などとしておいた方がサンプルコードを見た方が何が出来て、何が出来ないか判り易くて良いかなと思います。 関連して、FileRegexpValidatorとRegexpValidatorでマッチフラグを引数に取れるようにするのも良いと思いますがどうでしょう? public FileRegexpValidator(final String regex); public FileRegexpValidator(final String regex, final int flags); public FileRegexpValidator(final String regex, final String messageKey); public FileRegexpValidator(final String regex, final int flags, final String messageKey); add("file", new FileRegexpValidator(".+\\.(png|jpg)"), Pattern.CASE_INSENSITIVE); |
Comments |
Comment by jfut [ 2008-01-12 ] |
ありがとうございまーす。 |
Comment by agata [ 2008-01-12 ] |
r633で対応しました。 |
Comment by jfut [ 2008-01-12 ] |
こちらの方が良さそうですね。こちらでお願いします。 |
Comment by agata [ 2008-01-11 ] |
いいですね。コメントやサンプルコードへの追加賛成です。 マッチフラグはちょっとリッチすぎるかなーという気もしました。 |