I'm trying to do a regex which accepts a string containing 3-10 characters (white spaces before and after the string are allowed).
Why does this:
return (this.state.user.name.match(`^\s*([a-zA-Z0-9.\-_]{3,10})\s*$`));
returns false when I try to put white space(s) before and/or after the string? (it works correctly if I don't put white spaces.)
I am probably missing something, because it works using the regex tester: https://regex101.com/r/2371SM/1
Thanks for your help.