Re: Almost working Regex
| From: | Yasuo Ohgaki | Date: | Tue, 06 Mar 2001 07:14:03 +0000 |
| Subject: | Re: Almost working Regex | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-42715@lists.php.net to get a copy of this message | ||
> For data validation, I am using the following regex:
>
> $Status = (ereg("^(^[A-Za-z0-9` !@#$%&()=:;\"\'.?/^|{}-]*)(.*)$",
> $String,
> $List));
>
> This works perfectly for the moment. However, I need to add both square
> brackets [] to the list of allowed characters above.
This is JavaScripts RegEx reference page,
http://developer.netscape.com/docs/manuals/communicator/jsref/corea3.htm#115
8210
Any regular expression references will be probably helpful. How about look
for some?
([] are meta chars, you need to escape meta chars.)
Regards,
Yasuo Ohgaki
>
> But when I add the closinjg bracket ], the regex stops working. There are
no
> errors, but it accepts any and all characters as valid.
>
> How can I add these additional characters to the regex and avoid this
> problem?
>
> Thanks.
>
> ======================================================================
> Murray Shields Email: murray@globalcat.com.au
> MU Systems Pty Ltd Phone: +61 7 3351 6677
> Global Catalogs Pty Ltd Phone: +61 7 3351 4777
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>