regular expression

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Can anyone advise on the correct regex to specify a string that starts
with two letters followed by 11 digits?
Many thanks.

Re: regular expression

Quoted text here. Click to load it


that assumes i take you literally and that it doesn't matter what follows  
the 11 digits...else, this means nothing can follow the 11th digit:


Re: regular expression

Steve wrote:
Quoted text here. Click to load it

If you take him completely(!) literally, it would be:


This would also match:


Which does start with two letters and is followed (though not immediately)  
by 11 digits. You could even go further and include non-latin letters in  

I guess though that what he wanted was /^[a-z]\d$/i.

Toby A Inkster BSc (Hons) ARCS
[Geek of HTML/SQL/Perl/PHP/Python/Apache/Linux]
[OS: Linux, up 3 days, 22:27.]

                      Sharing Music with Apple iTunes

Re: regular expression

Toby A Inkster:

Quoted text here. Click to load it

Totally completely literally:


Quoted text here. Click to load it

Abso-tota-completely literally.


Re: regular expression

In reply to Your message dated Tuesday, December 11, 2007, 03:15:30,

Quoted text here. Click to load it

But... Which letters?
Should it be the ASCII letters from A through Z? May it include letters with
diacritics? Any non-latin letters? Other word symbols?

Reading Your request in terms of RE, I've end in


Or same way:


Which means "A string that started with 2 word characters which immediately
followed with 11 numeric characters"

But... read questions above.


Site Timeline