Check the first 3 characters of a string

Given "052 ...." I need to check that the first two characters are "05" and the third is from 0 to 9, but not 1. I tried:

var regex = /^[05]+[0,2-9]/;

      

+3


source to share


1 answer


Almost there:



var regex = /^05[02-9]/;

      

+6


source







All Articles