Hi folks.  I'm having a little bit of a stupid moment with a regular
expression which I'm hoping someone can lend a hand with.

The regular expression I have right now matches strings between 2 and
1000 characters in length that start with one of the following
characters:

a-z
A-Z
0-9
(
)

and where the rest of the string may be made up of the following
characters:

a-z
A-Z
0-9
(
)
_
,
.
-
'
"

Here's the working regular expresssion:

/^[a-zA-Z0-9\(\)]{1}[ a-zA-Z0-9\(\)_\,\.\-\'\"]{1,999}$/

Now, I'm trying to add \ to the valid characters but when I add a slash
after \" I get the following error:

Warning: Compilation failed: missing terminating ] for character class
at offset 54 in
/u0/vservers/*****/html/classes/forms/forms_validation_functions.class.p
hp on line 184

So I escape the \ with another \, and I still get the error.

Three or four  \ results in the \ character being stripped from the
string that is being tested with the regular expression.

Five \ results in the orignal error which I get with just one \.

Can anyone give any advice as to why this is happening?

Cheers and TIA.

Pablo




/^[a-zA-Z0-9\(\)]{1}[ a-zA-Z0-9\(\)_\,\.\-\'\"]{1,999}$/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to