当前位置: 动力学知识库 > 问答 > 编程问答 >

regex - 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;

网友答案:

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;
分享给朋友:
您可能感兴趣的文章:
随机阅读: