as a rule, please always clarify what "doesn't seem to work" means -- e.g. what did you expect to get? what did you actually get?
that aside, it looks like it's just a matter of case -- the
a-z is just lower case letters, but your data has upper case.. to fix this, either do
[a-zA-Z] or add the
/i modifier.
One other issue -- you have
[^a-z] -- that caret in there actually negates the character class, so what it means is NOT a letter (but you're right that the
/^ matches the beginning of the string)..
so altogether, try:
/^[A-Z]+([0-9]+)/i; You might also consider
/^\w+(\d+)/ (note this will accept underscores as well as letters) -- see
perlre for
\w and
\d ...