Update to my Apollo regex checker

This post is more than 2 years old.

I love you guys so much that I spent my lunch not just watching the Young and the Restless, but also improving my ugly little Apollo Regex Checker. (Ok, so I did watch Y and R while I coded.)

This new version now uses HTML mark up to show your matches, and lets you toggle between one match and multiple matches.

I have to say I really went down the wrong path trying to get my regex working right. Turns out there was a much simpler way to mark up the matches. This is my new AS code:

private function testRegex():void { var regexStr:String = regex.text; var bodyStr:String = body.text; var options:String = "";
if(regexStr == '' || bodyStr == '') {
	mx.controls.Alert.show("Please enter a regex and a body.");

if(global.selected) options = "g";
var regexOb:RegExp = new RegExp(regexStr,options);

//any matches?
if(!regexOb.test(bodyStr)) return;

body.htmlText = bodyStr.replace(regexOb,"<b>$&</b>");


Next will be a version that lets you test replacements as well.

By the way - Apollo notices if you run the same AIR twice. It asks you if you want to replace the old version. Sweet.

Download attached file.

Raymond Camden's Picture

About Raymond Camden

Raymond is a senior developer evangelist for Adobe. He focuses on document services, JavaScript, and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA https://www.raymondcamden.com

Archived Comments

Comment 1 by Shane Montgomery posted on 3/21/2007 at 11:40 PM

Raymond, this is neat and all, but how about some Paging in Flex on a datagrid? :-) Kidding, but seriously this is some great stuff! Keep it up

Comment 2 by Raymond Camden posted on 3/22/2007 at 12:18 AM

In my spare time... ;)