简体   繁体   中英

how to write a php regex for a string that start with one character followed by 6 numbers

I would like to write a regex to match a string starts with one character followed by 6 numbers. below is what i write:

$pattern  = '/^[a-z][0-9]{6}$/'

I am not sure if it is correct. If it is not correct, how to write the regex?

也就是说,它以一个小写字母开头,如果您也想覆盖大写字母,则:

$pattern  = '/^[a-zA-Z][0-9]{6}$/'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM