I’d like to extract the number(s) from in between the square brackets in a string like this:
"Item5Line[14].Id"
What I have so far causes an error in Javascript:
index = Id.attr('name').match(/\[\d\d?\d?\]);
I’m very new to regular expressions, so please be gentle 🙂
Thanks in advance!
Try:
index = Id.attr('name').match(/\[(\d+)\]/);Then you can pull out the match at index 1.