I want a regex for string with 6-12 characters long, start with number, followed by anything and end with non-alpabet and non-number. i have this, but this does not work. Any help here? examples are 123abc$$
, 2%fat?
, 4ever!@
^[0-9](?=.*)[^a-z0-9]{6,12}$
Don't use a lookahead, because it doesn't consume characters, it just requires the regular expression to be next to that. You also don't need 6-12 non-alphanumerics, that's only the last character.
^\d.{4,10}[^a-z\d]$
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.