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.