Reputation: 170
I need to extract in actionscript the variables from a string like /var1/var2/var3/...
Each variables can be characters or/and number and variable size.
My current regex /(\w+)/g
work for the first variable but not for the others.
var matchExpression:RegExp = /(\w+)/g;
var match:Array = matchExpression.exec(browserManager.fragment);
Thank you!
Upvotes: 0
Views: 652
Reputation: 170
Thank you Chase!
The solution :
var match:Array = browserManager.fragment.split("/");
Upvotes: 0
Reputation: 8226
I'm going to recommend Expresso 3.0 here - very easy to use and build up strings with.
Do you have a larger or better string example? i.e. will it always be varx\varx\myvarx?
/(\w+)/g doesn't seem to be working on my machine - you sure this works?
Upvotes: 0
Reputation: 15851
Regular expressions are not ideal for this. Why not use String.split()?
Upvotes: 2