The text has the lines (in this format):
Here's my pattern:Did you know Mary is 15 years old?
Did you know Joe is 57 years old?
Did you know John is 6 years old?
Did you know Melissa is 99 years old?
Implemented into JavaScript:Code:Did you know ([A-Za-z]+) is (\d+) years old
The problem is, matched[1] = "Did you know Mary is 15 years old"Code:var matched = text.match(/Did you know ([A-Za-z]+) is (\d+) years old/);
It always equals that... How do I get them into an array, where I can loop through? For example, index 0 would have Mary's details, index 1 would have Joe's details, index 2 is John's, and so on...
Thanks guys![]()




Reply With Quote
