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