ActionScript Regular Expressions Testing Tool
This is a simple tool for testing regular expression patterns for ActionScript. I’ve found that whenever I’m working with regular expressions in any language, the hardest part is getting the intricacies of the pattern worked out. This becomes much more complicated when you’re trying to debug a pattern in the context of its containing application. I made the ActionScript Regular Expressions Testing Tool tool to help simplify the process of figuring out the right regular expression pattern.
The tool has two text input fields, where you enter the RegExp pattern you want to use (without the / / delimiters or option flags), and another where you enter a test expression. There is also a field for entering any of the optional flags you might want to use. Finally, you can choose whether to use the RegExp.exec() method or the String.match() method for testing capturing groups, because those methods behave differently with certain option flags set.
When you run a test, you get three sets of output:
- A boolean “match” field tells you if the pattern matches at all
- A “matches” section lists the index and value of all the pattern groups in the result array
- A “named matches” section lists any named match groups that were captured
Here is a link to a running version of the ActionScript Regular Expressions Testing Tool. From that page, to or download the source code right-click on the tool and choose “View Source”.
The source code for this tool is released under the Mozilla Public License, version 1.1.
If you have comments or improvements for the project, feel free to add a note in the comments or contact me.
You can leave a comment, or trackback from your own site.
2 Comments so far
Add your comment
Comment notes
Please keep comments on topic. Comments that are inappropriate or offensive will be edited or removed.
Paragraphs and line breaks are automatically converted to HTML, and quotation marks are converted to “smart” quotes.
The following XHTML tags can be used: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> . All others will be removed.
July 29th, 2008 at 12:58 pm
Alex is reported to have said:
Hey there,
I had a question about something I’m working on. I’m a beginner at regular expressions and they confused the hell out of me. If anyone actually knows how to do this stuff could you give me examples of code and/or explain to me in very simple terms what I have to do?
What I’ve done so far is gotten the source of a page to come back to me in the form of a string. In this source there’s a table (in html), which I sort of need to use to create a table of my own… I mean, with those numbers in that table. So I used a regular expression to take out everything between the two tags. I basically used this to do that : var pattern:RegExp = /(.*?)/;
But now, I’m trying to create a 2-d array and put the columns and rows from the html table into that. So does anyone know how I can do that? What code to use?
Thanks!
July 31st, 2008 at 2:31 am
Matt is reported to have said:
Hi Paul
Thanks for your reg ex checker. It saves me countless headaches. I use it every time I need one. Great work.