At 1/10/14 12:29 PM, Diki wrote:
Ahh, okay. I get what you're doing now. That actually makes things quite easy, since you can just use some esoteric punctuation as the delimiter instead of the comma.
That's exactly the idea. Although you interpreted it a bit wrong. I work with only 3 different kinds of arrays: the first kind may contain only numbers. The second kind may contain nulls, numbers and nested arrays. The third kind contains only strings. And all these arrays are written in a .AS file (in a plain text file) that I am parsing. The .AS file is actually working code which is supposed to be compiled by Flash, so I must not replace commas with grave accent.
In the file, I need to find the character from which every array starts, and find the character on which the array ends. Then I need to cut out space in between start and end (the array's brackets) and apply RegExp on it.
The array which contains strings will have
And the text file will look like
array1=["Prepare to meet your ancestors!","What \"ancestors\" are you talking about, huh?","string3","etc"];
So I'll need to first find where array1 starts and ends, then cut out a piece of it and use RegExp on it
//piece will look something like
Prepare to meet your ancestors!","What \"ancestors\" are you talking about, huh?","string3","etc
//the delimiter is ","
oops, I accidentally did it without using RegExp.
I could do that. It's been a couple years since I've written AS3, so I would need a quick refresher on the syntax, but I might end up writing another tutorial for that thread. Who knows?
Well, your code with tacos
trace("TACOS blah blah 42 woop FOO BAR ding dong".match(/[a-z0-9]+/g));
works in ActionScript 3 without any modifications.
But the tutorial would be more about explaining how RegExp works, what are its limitation, strong points, etc. To test it out in AS3 match and trace are good.