Regex Question
| From: | Murray Shields | Date: | Fri, 18 Aug 2000 16:29:36 +0000 |
| Subject: | Regex Question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-12494@lists.php.net to get a copy of this message | ||
I have written a generic class that I am using in PHP3 to generate XML
statements. Everything is working perfectly except that I want to verify
that the variable names that are passed to the class are valid (according to
XML rules).
Therefore I wish to pass a string of any length through a regex to check its
validity, but I have no idea how to do this.
The rules are:
The FIRST CHARACTER must be an underscore "_" or an alpha character (upper
or lower case, no numbers).
ALL OTHER CHARACTERS must be alphanumeric OR underscore "_" OR minus "-" OR
period "."
Can anyone help me to achieve this?
======================================================================
Murray Shields Email: gcat @ bigpond.net.au
Global Catalogs Pty Ltd WWW: http://www.globalcat.com.au
Brisbane Australia Phone: +61 7 3351 4777
----------------------------------------------------------------------
Professional Internet Services for Business: Retail Web Catalogs, Web
Design, Corporate Email Delivery, Inhouse Web Servers and Consultancy.
======================================================================