-1

I'm struggling to find the right regex to validate an input.
I need a regex to match an alphanumeric string which ends with 9 digits, no more, no less.
All the spaces and special characters are stripped before the check, they don't matter here.

Examples of what I need :

SHOULD MATCH :

  • perpignan123456789
  • DEINOjeonfjuefz123456789
  • a123456789
  • 123456789

SHOULD NOT MATCH :

  • perpignan1234
  • 123456789fdazda
  • perpignan1234567890123456

I think I'm close to the solution with : [A-Za-z]{0,}[0-9]{9}$

The problem is that it returns "true" when tested with : perpignan1234567890123456

Some help would be appreciated,
Thanks in advance :)

SGig
  • 1

1 Answers1

-1

Try this one:

[A-Za-z]{0,}[0-9]{9}\D