Skip to content

Commit

Permalink
Alpha Complete validator now allows for | # = characters
Browse files Browse the repository at this point in the history
  • Loading branch information
micheleangioni committed May 16, 2017
1 parent 191c24d commit 50d0a19
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -541,7 +541,7 @@ min and max allowed values can be inserted.

Just after registering the SupportServiceProvider, the following new custom validators will be available:

- alpha_complete : The following characters are allowed: letters, numbers, spaces, slashes and several punctuation characters _ ! . , : / ; ? & ( ) [ ] { }
- alpha_complete : The following characters are allowed: letters, numbers, spaces, slashes, pipes and several punctuation characters | = # _ ! . , : / ; ? & ( ) [ ] { }
- alpha_space : The following characters are allowed: letters, numbers and spaces
- alpha_underscore : The following characters are allowed: letters, numbers and underscores
- alpha_names : The following characters are allowed: letters, menus, apostrophes, underscores and spaces
Expand Down
4 changes: 2 additions & 2 deletions src/MicheleAngioni/Support/CustomValidators.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class CustomValidators extends \Illuminate\Validation\Validator
{

/**
* alpha_complete permits the following UNICODE characters: alphabetic, numbers, spaces, slashes, ed some punctuation characters
* alpha_complete permits the following UNICODE characters: alphabetic, numbers, spaces, slashes, pipes ed some punctuation characters
* N.B. In order to add the '?' the \\ must be used
* N.B. The final u is a modifier, see http://php.net/manual/en/reference.pcre.pattern.modifiers.php
*
Expand All @@ -15,7 +15,7 @@ class CustomValidators extends \Illuminate\Validation\Validator
*/
public function validateAlphaComplete($attribute, $value)
{
return preg_match('/^([-\p{L}*0-9_+!.,:\/;\\?&\(\)\[\]\{\}\'\"\s])+$/u', $value);
return preg_match('/^([|=#-\p{L}*0-9_+!.,:\/;\\?&\(\)\[\]\{\}\'\"\s])+$/u', $value);
}

/**
Expand Down

0 comments on commit 50d0a19

Please sign in to comment.