Closed woodgates closed 5 years ago
Hello @woodgates I tried to reproduce your issue using the following code
const {rule, validate} = require('indicative')
const rules = {
name: [rule('min', 7), rule('max', 35), rule('regex', /^[a-zA-Z0-9,. ]+$/)]
}
const data = {
name: 'Mi Empresa <S.A.&!!'
}
validate(data, rules)
.then(() => console.log('passed'))
.catch(err => console.error(err))
but when run, it fails with the following error
[{
validation: 'regex',
field: 'name',
message: 'regex validation failed on name'
}]
So the regex rule seems to work fine.
Can you please give us more details about your setup? I am just curious about what caused it to pass in your case!
Please close the issue. The problem was another and it was solved in oher post.
Jorge Yoma R. P: +56 9 3439 4242<tel:+56%209%203439%204242> [LinkedIn]https://link.getmailspring.com/link/EE070156-A761-4E95-A6A9-66555F130F64@getmailspring.com/0?redirect=https%3A%2F%2Fwww.linkedin.com%2Fin%2Fjorge-yoma-a6120517&recipient=cmVwbHkrQUJMTE9FSEM0TllPSVpRTUJMVU5HRE4zRkVIWVpFVkJOSEhCV0RQWE1VQHJlcGx5LmdpdGh1Yi5jb20%3D On Jul 2 2019, at 6:39 pm, Amine Ben hammou notifications@github.com wrote: Hello @woodgateshttps://link.getmailspring.com/link/EE070156-A761-4E95-A6A9-66555F130F64@getmailspring.com/1?redirect=https%3A%2F%2Feur02.safelinks.protection.outlook.com%2F%3Furl%3Dhttps%253A%252F%252Fgithub.com%252Fwoodgates%26data%3D02%257C01%257C%257Cbef6b7ab9cb14ca2d0b208d6ff3e198c%257C84df9e7fe9f640afb435aaaaaaaaaaaa%257C1%257C0%257C636977039510142904%26sdata%3DHNRAkzevneQXFn5hKncSzKfZT9PRRRzsCRBKPGSpi1w%253D%26reserved%3D0&recipient=cmVwbHkrQUJMTE9FSEM0TllPSVpRTUJMVU5HRE4zRkVIWVpFVkJOSEhCV0RQWE1VQHJlcGx5LmdpdGh1Yi5jb20%3D I tried to reproduce your issue using the following code
const {rule, validate} = require('indicative')
const rules = { name: [rule('min', 7), rule('max', 35), rule('regex', /^[a-zA-Z0-9,. ]+$/)] }
const data = { name: 'Mi Empresa <S.A.&!!' }
validate(data, rules) .then(() => console.log('passed')) .catch(err => console.error(err))
but when run, it fails with the following error
[{ validation: 'regex', field: 'name', message: 'regex validation failed on name' }]
So the regex rule seems to work fine.
Can you please give us more details about your setup? I am just curious about what caused it to pass in your case!
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://link.getmailspring.com/link/EE070156-A761-4E95-A6A9-66555F130F64@getmailspring.com/2?redirect=https%3A%2F%2Feur02.safelinks.protection.outlook.com%2F%3Furl%3Dhttps%253A%252F%252Fgithub.com%252Fpoppinss%252Findicative%252Fissues%252F227%253Femail_source%253Dnotifications%2526email_token%253DABLLOECN2HP5STRRUTLGGWTP5PKIZA5CNFSM4HWJPKEKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZCXZCA%2523issuecomment-507870344%26data%3D02%257C01%257C%257Cbef6b7ab9cb14ca2d0b208d6ff3e198c%257C84df9e7fe9f640afb435aaaaaaaaaaaa%257C1%257C0%257C636977039510152915%26sdata%3DfK3RTxpc%252BipJZqyB129cfM1NMq7WJ%252FRNhR7Bjs1roU8%253D%26reserved%3D0&recipient=cmVwbHkrQUJMTE9FSEM0TllPSVpRTUJMVU5HRE4zRkVIWVpFVkJOSEhCV0RQWE1VQHJlcGx5LmdpdGh1Yi5jb20%3D, or mute the threadhttps://link.getmailspring.com/link/EE070156-A761-4E95-A6A9-66555F130F64@getmailspring.com/3?redirect=https%3A%2F%2Feur02.safelinks.protection.outlook.com%2F%3Furl%3Dhttps%253A%252F%252Fgithub.com%252Fnotifications%252Funsubscribe-auth%252FABLLOEGWEIJAZXFPBAA7ZUDP5PKIZANCNFSM4HWJPKEA%26data%3D02%257C01%257C%257Cbef6b7ab9cb14ca2d0b208d6ff3e198c%257C84df9e7fe9f640afb435aaaaaaaaaaaa%257C1%257C0%257C636977039510162920%26sdata%3DgxxGG4sqPPqHx94qgUrTcYnLwCRVQs6TN2qI%252FFid2AI%253D%26reserved%3D0&recipient=cmVwbHkrQUJMTE9FSEM0TllPSVpRTUJMVU5HRE4zRkVIWVpFVkJOSEhCV0RQWE1VQHJlcGx5LmdpdGh1Yi5jb20%3D.
Prerequisites
We do our best to reply to all the issues on time. If you will follow the given guidelines, the turn around time will be faster.
Delete the above section and the instructions in the sections below before submitting
Package version
Im using Indicative with Validator on Adonisjs "@adonisjs/validator": "^5.0.6",
Node.js and npm version
npm 3.5.2 node v8.10.0
Sample Code (to reproduce the issue)
BONUS (a sample repo to reproduce the issue)
Hi. I have this regex that allows only letters, numbers, commas and periods, tested on https://www.debuggex.com. Min and Max are working.
Regex doesn't work at all. For example, "Mi Empresa <S.A.&!!" passes. Tried with different regexs and most of the time it doesn't work as expected.