[thelist] Javascript regular expression

Liorean Liorean at user.bip.net
Sat Feb 2 16:22:01 CST 2002


At 08:49 2002-02-02 -0800, Roy Rubin wrote:
>Hello,
>
>I need to validate a field so that NONE of the following characters will be
>entered:
>
>\/:*?"<>|
>
>Any ideas on how to do this?

var str="teststring:", re=/\\|\/|:|\*|\?|\"|\<|\>|\|/g;
if(re.test(str))
alert("str contains one or more occurrence of one or more of the following
characters:\n'\\', '/', ':', '*', '?', '\"', '<', '>', '|'\n\nPlease remove
that and try again");

// Liorean




More information about the thelist mailing list