indicative icon indicating copy to clipboard operation
indicative copied to clipboard

Regex vaidation expect to end with $

Open soubhikchatterjee opened this issue 4 years ago • 3 comments

Package version

7.2.1

Node.js and npm version

Node: v12.4.0 npm: 6.13.7

Sample Code (to reproduce the issue)

Following code works:

 const rules = {
    username: [
      validations.required(),
      validations.regex(["^[a-zA-Z0-9._-]+$"])
    ]
  };

Following code does NOT work:

 const rules = {
    username: [
      validations.required(),
      validations.regex(["^[a-zA-Z0-9._-]+"])
    ]
  };

https://indicative.adonisjs.com/validations/master/regex The regex expects to end with $, otherwise it doesn't work

soubhikchatterjee avatar May 04 '20 06:05 soubhikchatterjee

Can you share the inputs against which the regex are tested along with the expected behavior and the actual behavior

thetutlage avatar May 04 '20 06:05 thetutlage

Kindly check the code i shared https://codesandbox.io/s/laughing-snow-py2h8?file=/src/index.js

There are two examples, example 1 works, example 2 does not work as expected.

soubhikchatterjee avatar May 15 '20 10:05 soubhikchatterjee

@thetutlage Did you get a chance to look into the code samples?

Thanks

soubhikchatterjee avatar Jun 08 '20 04:06 soubhikchatterjee