regex - how to get length of substring in Regular Expression JavaScript -
here regular expression
/^[a-za-z0-9-]{40}([a-za-z0-9-]{3}2[a-za-z0-9-]{12}){2,10}$/
there 1 condition: length of every string after first 40 characters must 16 characters. 16 characters string non repeating , minimum of 2 times , maximum of 10 times. want length of sub-string should 16.
here input string:
string input="pr212d4eb2-6b25-4020-bd2a-941f69c0aa4102gex2421262506027gex2437345435522"
i want match length of "gex2421262506027" , "gex2437345435522". this, there 10 strings max. want validate if length should 16 characters.
try this
var pattern = /^[a-za-z0-9-]{40}([a-za-z0-9-]{3}2[a-za-z0-9-]{12}){2,10}$/; var exp = text.match(pattern); if (exp) { alert(exp[0].length); }
Comments
Post a Comment