Monday, January 18, 2010

Using named groups with Regular Expressions

This is always a neat trick that I seem to always forget about, so I thought I’d post it here. When working with Regular Expressions, the RegExp class supports named groups. So instead of having to go through the RegExp result and access it like an array ([1], [2] .. [n]), you can use named results. Long story short, it can make working with the results a bit more intuitive. I made a simple example below which parses the user’s Flash Player version and displays the operating system/platform, major revision, minor revision, build number and internal build number.

Full code after the jump.

(more…)

flex regular expressions

No comments:

Post a Comment

Your comments is appreciate.