I'm just loving Apollo. This morning I built a quick regex tester. It only does global style matches, but it is a good first draft. Download it by clicking the Download link below.
In the next version I'll switch to using highlight on the original text instead of a dump of matches. I'll also let you try out replacements as well.
Enjoy my lovely design skills. The code is below for those who are curious.
<?xml version="1.0" encoding="utf-8"?> <mx:ApolloApplication xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute" title="Regular Expression Tester"><mx:Script> <![CDATA[ private function testRegex():void { var regexStr:String = regex.text; var bodyStr:String = body.text;
results.text = '';
if(regexStr == '' || bodyStr == '') { mx.controls.Alert.show("Please enter a regex and a body."); return; }
var regexOb:RegExp = new RegExp(regexStr,"g"); var matches:Array = bodyStr.match(regexOb);
if(matches != null && matches.length > 0) { for(var i=0; i < matches.length; i++) { results.text += matches[i] + "\n"; } } } ]]> </mx:Script>
<mx:VDividedBox width="100%" height="100%">
<mx:Panel title="Regex" width="100%" height="70" >
<mx:HBox width="100%" height="100%">
<mx:TextInput id="regex" width="100%" height="100%"/> <mx:Button id="tstButton" label="Test Regular Expression" click="testRegex()" height="100%" />
</mx:HBox>
</mx:Panel>
<mx:Panel title="Body" width="100%">
<mx:TextArea id="body" width="100%" height="100%" />
</mx:Panel>
<mx:Panel title="Matches" width="100%">
<mx:TextArea id="results" width="100%" height="100%" editable="false" />
</mx:Panel>
</mx:VDividedBox>
</mx:ApolloApplication>