Small cleanup using static analysis

This commit is contained in:
HairyFotr
2014-05-31 00:51:25 +02:00
parent 1e8224536b
commit 7698f12112
14 changed files with 24 additions and 26 deletions

View File

@@ -10,7 +10,7 @@ trait Validations {
*/
def identifier: Constraint = new Constraint(){
override def validate(name: String, value: String, messages: Messages): Option[String] =
if(!value.matches("^[a-zA-Z0-9\\-_.]+$")){
if(!value.matches("[a-zA-Z0-9\\-_.]+")){
Some(s"${name} contains invalid character.")
} else if(value.startsWith("_") || value.startsWith("-")){
Some(s"${name} starts with invalid character.")