Flagrant Badassery

A JavaScript and regular expression centric blog

RegexPal Now Open Source

RegexPal (easily the most del.icio.used regex tester wink) is now released under the Creative Commons Attribution-Share Alike 3.0 License GNU LGPL.

There are certainly many more features that can be added to the app and things that can be improved, so if you are interested in helping out or creating your own version, you are welcome to do so. If there is interest I'll create a Google Code project, but for now there is a package you can download which includes all files for the regexpal.com website. Two of the files in the package (xregexp.js and helpers.js) are dual-licensed under the MIT License.

If you're only interested in the JavaScript, you can see the three source files here:

For regex aficionados particularly, there is some stuff here you might find interesting, including the latest, as-yet-unreleased version of my XRegExp library, and the regex syntax parser used for RegexPal's syntax highlighting (which includes lots of details on the minutiae of regex syntax and cross-browser regex handling).

There Are 15 Responses So Far. »

  1. Wow thanks. Yes a google code project would definitely be helpful.

  2. Aight, if one more person asks for it, I’ll set up the project. 😉

  3. Thanks for your great effort! ya I would love to see this in google code project 🙂

  4. Okay, gimme a few days and I should have a project set up somewhere. Not sure if it will be at Google Code, because due to their strong anti-license-proliferation stance they only allow projects hosted there to use one of a small number of licenses – which does not include the Creative Commons Attribution–Share Alike license RegexPal was released under. So, I’ll either up the version number and release it under a different license or host it elsewhere.

  5. Okay, it’s set up here: http://code.google.com/p/regexpal/

    Version 0.1.4 is licensed under the LGPL. RegexPal needs tons of work… if anyone wants to get involved in its development, please leave a comment here or email me at: steves_list at hotmail dot com.

  6. What features are you looking to add?

  7. @Justin, see http://code.google.com/p/regexpal/issues/list for starters. Some of the bigger features I think would be cool are a real-time regex explanation tree, more consistent cross-browser rich-text fields (for syntax and match highlighting), match and subgroup listings, the ability to replace matches with other text (using a syntax highlighted replacement field), JavaScript code generation, etc. But there are many other big and small things that could be useful too. Longer term, I want to be able to do automatic regex generation.

  8. This looks great!

    I wrote a tool for this a few years ago http://osteele.com/tools/rework/ , that has some features that I like: code generation for JavaScript/PHP/Python/Ruby; display a parse tree of the regex; display the FSA (currently busted?); display a list of matches. If I get some free time I’ll look at adding some of that functionality to your project, but in the meantime feel free to mine it for ideas and/or code — there’s no download page but the sources are unmimized. I hereby license it under the MIT License and the LGPL.

  9. @Oliver Steele, very cool! I’m a big fan of reWork, not to mention reAnimator and a lot of your other stuff. RegexPal’s Quick Reference is lightly adapted from reWork’s Help tab (noted here, and now also on the version history page).

    I just did an svn commit to bring things on Google Code up to date with regexpal.com (minor changes only). I’d love to add some of your reWork features to RegexPal. Unfortunately, I probably won’t be able to look into it myself in the short term due to a bunch of things going on right now.

  10. Hi Steve, just tried pulling apart the code you have for the syntax highlighter (as getting JavaScript to do that for me would be so much easier than how I’m doing it now – which is manually applying span tags with css classes) but unfortunately i’ve hit an issue when using character classes!

    The regex I’m using to check the syntax highlighter is working is:

    ^(?:[.\/]+)?(?:Assets|https?:\/\/(?!(?:www\.)?integralist))

    But the error I get is “Cannot read property ‘closing’ of null” (line 77 of your parseRegex function)

    If I remove the character class then it works fine?

    Also, can you advise how to work around including the XRegExp library? I can see in the code for the parseRegex function it uses the XRegExp.cache() method (I’m guessing for efficiency to save the same regexes being constantly executed), but it seems like a lot of redundant code is being downloaded just for the cache method (although in fairness, for your usage within the context of the RegexPal tool it makes sense as you’re already using the XRegExp library as part of the application but for me using this code on my own site for highlighting regex syntax it seems like a lot of extra code I wont ever use, so any suggestions on how to remove it or reuse just that small portion if it’s critical to the functioning of the parseRegex method).

    Note: I downloaded your XRegExp.js from the XRegExp website and not from the link above and it seems I had to uncomment the addFlags code to stop the page from erring (as you removed the code from future versions of XRegExp).

    Thanks for any help you can give me.

    Kind regards,
    Mark

  11. It seems using the version of XRegExp linked to from this post (version 0.2.5) means the syntaxHighlighting works fine! But for some reason not with the latest version 1.5.0?

  12. @Mark McDonnell, RegexPal hasn’t had any significant changes for a long time, and it needs a fair bit of cleanup and other work (including upgrading to the latest XRegExp). Versions of XRegExp prior to 0.5 used different named capture syntax, which is why RegexPal’s parseRegex function doesn’t work with the latest XRegExp.

    In any case, just for you, 😉 I’ve extracted the parseRegex function and made the minimum additional changes necessary to turn it into its own standalone library (boringly called “JavaScript Regex Syntax Highlighter“). Hopefully this helps!

  13. Seriously, that is immensely cool of you to do that! Thank you so much – this is going to save me some mega grief in the future!! 🙂

  14. Really helpful!! //Seems I am the newest response now! lol
    Our teacher recommended it to us, and asked us to learn the code and to write a little program in Java to accomplish the same function.
    Thank you so much~

  15. ??????????????????????
    ???????????????????????????? ????????? ?????? ????? ?????????????N???????
    ????????????????????????
    ?????????????????????????
    ??????????????????????
    ???????????????????
    ???????????????????????????
    ???????????????
    ???????????????????
    24?????????3?4???????

Post a Response

If you are about to post code, please escape your HTML entities (&, >, <).