2011-06-09 10 views

Respuesta

34

Puede utilizar la expresión regular:

^[A-Z0-9]{3}(?:List)?$ 

Explicación:

^  : Start anchor 
[A-Z0-9] : Char class to match any one of the uppercase letter or digit 
{3}  : Quantifier for previous sub-regex 
(?:List) : A literal 'List' enclosed in non-capturing paranthesis 
?  : To make the 'List' optional 
$  : End anchor 

See it

+3

que funciona un lujo, y gracias por incluyendo una explicación también, expresiones regulares está empezando a tener más sentido para mí ahora Aunque no por mucho ...; P – w69rdy

+0

@ w69rdy lea esto. http://www.slideshare.net/andreizm/andreis-regex-clinic – JJS

Cuestiones relacionadas