The first time through the loop result is, well, like your output says,
undefined. You don't set result equal to anything until after your first
trace... you also don't even show result being defined, so I'm really just
guessing at what's happening...

Troy.


On 02 Apr 2007 16:57:51 -0700, jmfillman <[EMAIL PROTECTED]> wrote:

  This seems like an easy enough thing to do, and have done it hundreds
of time before, but this one's got me stumped.

public function toWords():void{
var str:String = myRTA.text;
var pattern:RegExp = /\b[A-Za-z0-9'-]+\b/gi;
while (result != null) {
trace (result.index, result);
result = pattern.exec(str);
}
myDGrid.dataProvider = result;
}

If I pass the text "What's your name?" to the RegExp, the trace
returns the following:

undefined
0 What's
7 your
12 name

My first question is why is the first line "undefined"? Second, I
can't seem to make this output post to a DataGrid. What am I doing
wrong?

Reply via email to