How to write Regular Expression for number,characters,alphanumeric
I am using Zend_Validate_Regex, I need开发者_运维知识库 the regular expression which has the following check,
- 123456 - Accepted
- 12345A - Accepted
- A12345 - Accepted
- ABCDEF - Accepted
Kindly help
Use this regex: (?i)^[\da-f]+$
If you are expecting an hexadecimal number, the regular expression is:
/[0-9A-F]*/
May be, you want to use also non capital letters:
/[0-9A-F]*/i
Or perhaps you want to use exactly 6 characters (numbers and letters):
/[0-9A-F]{6}/i
精彩评论