开发者

How to write Regular Expression for number,characters,alphanumeric

开发者 https://www.devze.com 2023-03-20 17:18 出处:网络
I am using Zend_Validate_Regex, I need开发者_运维知识库 the regular expression which has the following check,

I am using Zend_Validate_Regex, I need开发者_运维知识库 the regular expression which has the following check,

  1. 123456 - Accepted
  2. 12345A - Accepted
  3. A12345 - Accepted
  4. 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
0

精彩评论

暂无评论...
验证码 换一张
取 消