Well,
Yes as I stated before this line is where my error was at. Looks like inverted the function; Line: if (token = regMetar.test()) should really have been: if (regMetar.test(token)) Got this from a referenced code on the wiki app that is in the Adobe site. I just read it wrong and I was thinking with my 20+ years of faded programing... it´s been that long since I coded :) Thanks for the input FlexiSush Regards, Jose On Mar 10, 8:08 pm, FlexiSush <sushant...@gmail.com> wrote: > Hi, > First upon I would like to tell u that there is no match() method > for RegExp. There are some changes needs to be done in ur code. > use > > var metarDecoded:Array= new Array(); > for (var i:int = 0; i< arrayLeght; i++) > { > var token:String = arrayMetar[i]; > trace (token); > if (regMetar.test(token)){ > metarDecoded.push("This is a METAR"); > trace (metarDecoded + > metarDecoded.length); > } > /*trace ("Metar Array is "+ arrayMetar[i]);*/ > } > > I tried to execute ur code. It gives compile time error at > > if (token = regMetar.test()) > > This is because test() method will give Boolean value which u r > comparing with 'token' which is a String value. One more thing dont > use = operator for comparison. instead use ==. > > Regards,http://flexphpworld.wordpress.com/ > > On Mar 10, 9:36 pm, Jose Morales <jem...@gmail.com> wrote: > > > > > Hello All, > > > I was sent over to the experts after asking in several places. I am in the > > process of writing a small app that will use RegExp to translate a METAR > > (jargon weather information) > > Now, I have the Reg Expresions tested in a JS and also in a tckl scrip, but > > I doing this while I enjoy he IDE and lear AS on FLEX. > > > So, all I am doing is a sample string to test my algorithm. I can see that > > I am in the right track except when I attempt to validate the RegExp. > > > Here is my code so that you can have a better understanding: > > > package > > { > > import flash.display.MovieClip; > > > public class MetarAS extends MovieClip > > { > > public var metarString:String = "METAR LBBG 041600UTC"; > > public var arrayMetar:Array = metarString.split(/\s+/); > > public var arrayLeght:Number = arrayMetar.length; > > //public var metar:String = "METAR"; > > //public var zulu:String = "[0-9]{4}Z"; > > > public function MetarAS() > > { > > var regMetar:RegExp = new RegExp("METAR"); > > var regZulu:RegExp = new RegExp("[0-9]{4}Z"); > > var metarDecoded:Array; > > for (var i:int = 0; i< arrayLeght; i++) > > { > > var token:String = arrayMetar[i]; > > trace (token); > > if (token = regMetar.test()){ > > metarDecoded.push("This is a > > METAR"); > > trace (metarDecoded + > > metarDecoded.length); > > } > > /*trace ("Metar Array is "+ arrayMetar[i]);*/ > > } > > > } > > } > > > } > > > my error is in in this <snip> > > if (token = regMetar.test()){ > > metarDecoded.push("This is a METAR"); > > trace (metarDecoded + metarDecoded.length);} > > > </snip> > > I have looked at the documentation on the web, and I have see test() or > > match() but neither of these seem to work for me. > > All ´am doing in this example is building a new metarDecoded:Array if the > > toke matches "METAR" as per the RegExp("METAR") for var regMetar. > > > I greatly appreciate your help and fact that there is such a community > > like this. > > > Regards, > > Jose Morales > > jem...@gmail.com -- You received this message because you are subscribed to the Google Groups "Flex India Community" group. To post to this group, send email to flex_in...@googlegroups.com. To unsubscribe from this group, send email to flex_india+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/flex_india?hl=en.