|
-
Sep 30th, 2003, 10:15 AM
#1
Thread Starter
New Member
Automating Regular Expressions
I am looking to automatically generate regular expressions based on a user-defined form field 'template'.
For example:
(template) AAA-nnnnn-aaaaa
where A = capital character, a = lower case, n = optional numeral, and - = user-defined non-alphanumeric
e.g ABC-123-abcde
e.g. ABC-12345-abcde
For the example template above, I would expect to create the following regex:
/^[A-Z]{3}-[0-9]{0,5}-[a-z]{0,5}/; (or something like this!)
This regex will be used to validate the particular form value in the future. So a valid input would be ABC-123-abcde but AB3/123/123cd would't.
I guess it using regexes to create regexes!
Can any one assist? I hope this is clear enough
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|