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

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -