Lazao
Lazao

Reputation: 225

JavaScript Regex exclude brackets

I'm trying to make a simple validation in JavaScript & PHP (for double checking) by using regex. I just want to check that the names will be allowed if there is at least two of these characters:

letters + accents + spaces + simple quotes + dash

^[aA-zZ\u00C0-\u017F- \']{2,}$

Regular expression visualization

Debuggex Demo

But actually, brackets are allowed in my regex pattern (don't know why), and I'd like them to be excluded, how can I do that ?

I know that \u is not allowed in PCRE-like regular expressions.

Thanks

Upvotes: 3

Views: 167

Answers (1)

Musa
Musa

Reputation: 97672

The square brackets are between A and z I think you meant to have a-zA-Z in your regex.

Upvotes: 2

Related Questions