Archive for Regexp

AS3 Regexp

One think that I am really thankful is the addition of Regular Expression in AS3.
That’s really helping me around.

Here’s some cheatsheets that I always check:
http://krijnhoetmer.nl/stuff/regex/cheat-sheet/
http://regexlib.com/CheatSheet.aspx
http://www.ilovejackdaniels.com/cheat-sheets/regular-expressions-cheat-sheet/

Also, I uploaded my svn my StringUtils class
http://code.hellokeita.in/public/trunk/as3/br/hellokeita/utils/StringUtils.as

Actually, there’s just the trim method, but you see that’s it’s really easier than AS2.
\s|\n|\r|\t|\v <- I put all those characters to make sure every initial end final whitespace are trimmed.

Also, I uploaded my ColorUtils.as too.
You see that it's really easy to manage ARGB colors with it.
Also, there's a RGB -> Grayscale color converter.

Oh, don’t try converting a bitmapData pixel by pixel to generate a Grayscale image.
There’s an easier way to make it with the BitmapData.paletteMap() method.
but… I’ll keep it to the next post …. if anyone shows any interest.

Comments (2)