This problem is not easy, but to understand why you need to understand how the regular expression mechanism in your string works.
[a-z]{3} ( 3 a z) abcdef. ( a) , a [a-z], . , b [a-z] . , , c , ( d) abc .
, , (, , def).
b abc, bcd . , , .
, lookaheads , :
var str = "2010 Women Flat Track Derby Association",
regex = /([a-z0-9']+)(?=\s+([a-z0-9']+)\s+([a-z0-9']+))/ig;
while (match = regex.exec(str))
{
var group1 = match[1], group2 = match[2], group3 = match[3];
document.write("Found match: " + group1 + " -- " + group2 + " -- " + group3 + "<br />\n");
}
:
2010 -- Women -- Flat
Women -- Flat -- Track
Flat -- Track -- Derby
Track -- Derby -- Association
. http://jsfiddle.net/jRgXm/.
, , , ([a-z0-9']+), 1, lookahead ( , ), 2 3.
, Javascript, RegExp.exec (. , ). , UltraEdit, , , , .