Regular expression to match two numbers that are not equal

profile for Nikola at Stack Overflow, Q&A for professional and enthusiast programmers
I'm a big fan of Stack Overflow and I tend to contribute regularly (am currently in the top 0.X%). In this category (stackoverflow) of posts I will will be posting my top rated questions and answers. This, btw, is allowed as explained in the meta thread here.

My question was:

I was wondering how can I match two digits but which are not the same. So, it would be fine to match 12, but not 11.

What I have till now is: I have to match strings like "P12", and I've done it with this regex:


But now my problem is how to match only strings like P12 or P32 where the numbers do not repeat.

Any help or guidance to reading materials will be grateful.

edit:  this is what worked:


 The answer, by Ignacio Vazquez-Abrams, was:

Use this:

Written by Nikola Brežnjak