Hello,

I am trying to extract ALL strings between two apostraphes within a given string but for some reason I only seem to be getting the first one.

The string I am trying to extract from is:
'1962' '1963' '1964' '1965' '1966'

The code I'm trying to use to get all the extracts is:
var testRE; testRE = results.match("'(.*?)'");

(When I alert the length of testRE it only says 2).

Any help is appreciated, thanks!

Try this

var results ="'1962' '1963' '1964' '1965' '1966'";
var testRE = results.match(/'(.*?)'/g);
alert(testRE.length)
for(var i=0;i<testRE.length;i++){
alert(testRE[i])
}

or this one

    var results = "'1962' '1963' '1964' '1965' '1966'";
    alert(results)
    var testRE; 
    //testRE = results.match("'(.*?)'");
    var testRE = results.replace(/'/g,"").split(" ");

    alert(testRE.length);
    for(var i=0;i<testRE.length;i++){
        alert(testRE[i]);
    }

Great, the first one works perfectly. Thank you!

An implicit extraction instead of matching the data of interest would be

var results = "'1962' '1963' '1964' '1965' '1966'";
    results.match(/\w+/g);

>>[object Array]["1962", "1963", "1964", "1965", "1966"]