Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a new type to define custom regexp #4

Open
7 tasks
gustavonecore opened this issue Sep 7, 2022 · 0 comments
Open
7 tasks

Add a new type to define custom regexp #4

gustavonecore opened this issue Sep 7, 2022 · 0 comments
Assignees

Comments

@gustavonecore
Copy link
Owner

gustavonecore commented Sep 7, 2022

Before you start

  • Create a new branch from master using the convention of feature/{ticket-id}-description. For this case will be: feature/5-regexp-type
  • Every commit should follow the convention: #{ticket-id} :: {brief-description-of-the-change}.

Example of valid commits

#5 :: Added new regexp type class
#5 :: Refactor of main class in order to simplify strategy

Example of wrong commits

Update of class
Update
5 > Change of logic

Tasks

  • Add a new type class to validate if a string match a given regexp
  • The string used to identify this type would be: regexp[{expression}] where {expression} will be the regular expression string.
  • Add the related test
  • Update the example code
  • Update the readme

i.e: We want to create a validation code as follow: ^[0-9]{1,6}$

^     : Start anchor
[0-9] : Character class to match one of the 10 digits
{1,6} : Range quantifier. Minimum 1 repetition and maximum 6.
$     : End anchor

Related filter

$filter = new Gcore\Sanitizer\Template\TemplateSanitizer([
	'email' => 'string',
	'validation_code' => 'regexp[^[0-9]{1,6}$]',
]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants