mardi 2 février 2016

Regex in angularjs

I have to create a regex to validate ticket string in correct format

Ticket format - SFHD00002523003 ( starting with four alphabets and end with 12 numeric character

This is my code in my angular controller

Var pattern = new RegExp('[A-Z]{4}\d{12}$'); console.log(pattern.test('SFHD00002523003');

Unfortunately it is returning false for correct string also

Aucun commentaire:

Enregistrer un commentaire