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

Regex enable if value is not empty or null #268

Open
sachinda123456 opened this issue Sep 2, 2021 · 1 comment
Open

Regex enable if value is not empty or null #268

sachinda123456 opened this issue Sep 2, 2021 · 1 comment

Comments

@sachinda123456
Copy link

I have some regex pattern Called discount discount: { type: 'string', pattern: /(^\d+(.\d{2})?$){0,100}/ },
It enable max allow two decimal places and minimum number is 0 and max number is 100 . According to my requirement everything fine . But i need to check this regex pattern if discount field has a value . That mean i need to disable pattern check if key does not have value . how can i achieve this .Because current situation use not able to allow null in discount field .

@intech
Copy link
Contributor

intech commented Sep 2, 2021

add option in discount: optional: true

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