troubleshooting Question

How do I capture my groups in my actionscript 3 regular expression?

Avatar of rarid122481
rarid122481 asked on
Adobe FlashRegular Expressions
9 Comments1 Solution400 ViewsLast Modified:
I have a string that has several occurrences of the expression i want to capture. my current expression seems to capture the entire string instead an array of matches.

i have arrays that are marked at the beginning with an x = and a y = . these arrays are the strings i am trying to capture from the "newString" string.

how do i correct this? attached is my code.
var newString = "fb 2 hole x = [0,7.95684,14.4188,19.9262,24.6842,28.8171,32.4129,35.5395,38.2391,40.557,42.5312,44.1871,45.5487,46.639,47.4761,48.0774,48.4561,48.627,48.6009,48.3891,48]; y = [0,-13.3809,-27.5554,-42.1324,-56.9716,-71.9945,-87.1577,-102.446,-117.79,-133.189,-148.656,-164.161,-179.682,-195.229,-210.788,-226.372,-241.934,-257.536,-273.113,-288.688,-304.3]; 1 hole x = [0,-6.36551,-11.5654,-16.0647,-20.0354,-23.5785,-26.7549,-29.6131,-32.1886,-34.512,-36.6049,-38.4899,-40.1776,-41.6884,-43.0312,-44.2169,-45.2553,-46.156,-46.9261,-47.5711,-48.1]; y = [0,-14.1012,-28.6959,-43.5136,-58.4794,-73.5648,-88.7259,-103.95,-119.218,-134.533,-149.875,-165.264,-180.644,-196.067,-211.501,-226.94,-242.384,-257.848,-273.326,-288.787,-304.3];";

var str:String = newString;
var resultArray:Array = [];

var matches:Array = str.match(/x = (\[.*\];)/); 
if (matches) 
{
trace("matches.length: " + matches.length); 
}
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 1 Answer and 9 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros