php - Regular Expression first 2 characters either alphabetic or numeric but not combination of both -


i need regular expression in php validate string like: "ab345678" or "12345678". is, eight(8) letter string containing first 2 letters alphabetic or numeric, not combination of both, , remaining 6 letters numeric. tried own it's not working.

here code:

/^[0-9a-za-z]{2}[0-9]{6}$/ 

i'm new regex hence need here.

thanks in advance.

you can this

^([a-za-z]{2}|\d{2})\d{6}$ 

Comments

Popular posts from this blog

Why does Ruby on Rails generate add a blank line to the end of a file? -

keyboard - Smiles and long press feature in Android -

node.js - Bad Request - node js ajax post -