Another quick Apollo App

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="" 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 == '') {"Please enter a regex and a body.");

var regexOb:RegExp = new RegExp(regexStr,"g");
var matches:Array = bodyStr.match(regexOb);

if(matches != null && matches.length &gt; 0) {
	for(var i=0; i &lt; matches.length; i++) {
		results.text += matches[i] + "\n";
} }		 ]]&gt; &lt;/mx:Script&gt;

<mx:VDividedBox width=”100%” height=”100%”>

&lt;mx:Panel title="Regex" width="100%" height="70" &gt;

	&lt;mx:HBox width="100%" height="100%"&gt;
		&lt;mx:TextInput id="regex" width="100%" height="100%"/&gt; &lt;mx:Button id="tstButton" label="Test Regular Expression" click="testRegex()" height="100%" /&gt;

&lt;mx:Panel title="Body" width="100%"&gt;
	&lt;mx:TextArea id="body" width="100%" height="100%" /&gt;


&lt;mx:Panel title="Matches" width="100%"&gt;
	&lt;mx:TextArea id="results" width="100%" height="100%" editable="false" /&gt;



</mx:ApolloApplication> </code><p>Download attached file.</p>

Raymond Camden's Picture

About Raymond Camden

Raymond is a developer advocate for Extend by Auth0. He focuses on serverless and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support.

Lafayette, LA