As much as I love regular expressions, this seems like a job for e4x
instead:

var foo:XML = <name color="ffffff" size="20" />

var color:String = [EMAIL PROTECTED];
var size:String = [EMAIL PROTECTED];

If you don't know your attributes in advance, you can even do something
like

for each (var attribute:XML in [EMAIL PROTECTED]) {
    trace(attribute.name() + " is " + attribute.text());
}

(not exactly sure about the above, but it should get you on the right
track).


-- 
Maciek Sakrejda
Truviso, Inc.
http://www.truviso.com

-----Original Message-----
From: tchredeemed <[EMAIL PROTECTED]>
Reply-To: [email protected]
To: [email protected]
Subject: [flexcoders] Re: Regular Expressions?
Date: Mon, 17 Nov 2008 16:56:47 -0000

Ok, I have figured out a way to get the tags... now I have one
problem...

I get the name properties, like this:

var ptrn:RegExp = /<name(.?*)\/>/;

Now, is it possible to use a variable in there for name?

Something like this:

var field:String = 'name';
var ptrn:RegExp = /<field(.?*)\/>/;

Y/N?




 


Reply via email to