jquery - Matching the index number in attribute name inside nested array braces using regEx -


i need in regex, want index number match inside braces[1] text[alphanumeric][index][text] see attribute name below.

name="lorem[ipsum_dolor_set-amet-34][1][consectetuer]"

i have regex code below work.

my code: [\[^.*\]](\d+)

but result is, matched open brace , index < [1 > instead of index < 1 > only.

any answer appreciated.

thanks in advance. :)

but result is, matched open brace , index < [1 > instead of index < 1 > only.

i think regex code ok, using first index of match array.

var mystring = "name='lorem[ipsum_dolor_set-amet-34][1][consectetuer]'";   var arr = mystring.match(/[\[^.*\]](\d+)/);   console.log(arr[0] + " " + arr[1]); 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

javascript - addthis share facebook and google+ url -

ios - Show keyboard with UITextField in the input accessory view -