¿Regex para una cadena de longitud 9 y formato de AAANNNNNA?

I want regular expression for a string of length 9 and with format of


A- Alphabetic, N-Numeric

And also for AAANNNNNN

Por favor, ayúdame.

Muchas Gracias

preguntado el 31 de enero de 12 a las 16:01

This is not a 'give me the codez' site. At least show you've put SOME effort into figuring this out for yourself. -

Agree with Marc B. You might try google.co.uk/… -

Or, my personal favourite: regular-expressions.info -

1 Respuestas

La primera: [a-zA-Z]{3}[0-9]{5}[a-zA-Z]

Segunda: [a-zA-Z]{3}[0-9]{6}

Conjunto: [a-zA-Z]{3}[0-9]{5}[a-zA-Z0-9]

You can simplify this by using \d to represent digits: [a-zA-Z]{3}[\d]{5}[a-zA-Z\d]

Cómo funciona:

[] es una clase de personaje. a-z means the range a a z, A-Z is the same for caps, 0-9 is 0 a 9. El uso de {} afterwards means repeat, so {3} means repeat the previous pattern 3 times.

Regex isn't that hard to learn, go read up on it at http://www.regular-expressions.info/

Respondido el 31 de enero de 12 a las 21:01

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.