Emanuele Ugo
Emanuele Ugo

Reputation: 91

regular expression javascript with punct,space and alnum

Hello i need a regular expression for an empty string or a string with punct,alnum,and digit.

i try something like this but it doesn't work; what are my errors???

Thx for help

var regularExp=/(^$ || ^[[:alnum:][:punct:][:space:]]{80}$)/i;

Upvotes: 3

Views: 2369

Answers (1)

anubhava
anubhava

Reputation: 785186

Javascript regex cannot use POSIX character class as you're trying. Unfortunately it doesn't also support PCRE classes.

You can probably use:

var regularExp = /^([a-z0-9\.,-\/#!$%' "^&*;:{}=_`~()-]{80})?$/ig;

Upvotes: 5

Related Questions