Flagrant Badassery

A JavaScript and regular expression centric blog

RegexPal: Web-Based Regex Testing Reinvented

Yes I know, there are many other JavaScript regex testers available. Why did I create yet another? RegexPal brings several new things to the table for such web-based apps, and in my (biased) opinion it's easier to use and more helpful towards learning regular expressions than the others currently available. Additionally, most other such tools are very slow for the kind of data I often work with. They might appear fast when displaying 10 matches, but what about 100, 1000, or 5000? Try generating 5,000 matches (which is easy to do with an any-character pattern such as a dot) in your favorite existing web-based tool and see if your browser ever recovers (doubtful). The same task takes RegexPal less than half a second, and what's more, results overlay the text while you're typing it.

At the moment, RegexPal is short on features, but here are the highlights:

  • Real-time regex syntax highlighting with backwards and forwards context awareness.
  • Lightning-fast match highlighting with alternating styles.
  • Inverted matches (match any text not matched by the regex).
regexpal.com screenshot

I'm not sure when I'll add additional features, but there are lots of things I'm considering. If there is something you'd like to see, let me know.

A few things to be aware of:

  • The approach I've used for scrollable rich-text editing (which I haven't seen elsewhere) is fast but a bit buggy. Firefox 2 and IE7 have the least issues, but it more or less works in other browsers as well.
  • The syntax highlighting generally marks corner-case issues that create cross-browser inconsistencies as errors even if they are the result of browser bugs or missing behavior documentation in ECMA-262 v3.
  • There are different forms of line breaks cross-platform/browser. E.g., Firefox uses \n even on Windows where nearly all programs use \r\n. This can affect the results of certain regexes.

At least for me, RegexPal is lots of fun to play with and helps to make learning regular expressions easy through its instant feedback. I encourage you to just go play with it and discover its results on your own, but for the curious, I'll keep rambling…

Regex syntax parsing (needed for the syntax highlighting) is somewhat complex, due to the numerous backwards and forwards context awareness issues involved. Take, for example, the pattern \10. What does it mean?

  • Backreference 10, if not inside a character class and at least 10 capturing groups are opened before that point.
  • Backreference 1, followed by a literal "0", if not inside a character class and between 1 and 9 capturing groups are opened before that point.
  • Octal character index 10 (decimal 8), if inside a character class, or if no capturing groups are opened before that point.
  • The three literal characters "\", "1", and "0", if preceded by an unescaped "\" character.
  • An incomplete token in a couple other situations.

Another example is the "-" character. Outside a character class it's always a literal hyphen, but inside a character class…

  • It creates a range between tokens if:
    • There is a preceding and following token in the class, or it's preceded by a token and is the last character in an unclosed character class (caveats follow).
  • It's a literal character if:
    • It's the first or last character in the class.
    • It's preceded by an unescaped "\".
    • It follows a token which is the end index for a range.
    • It follows a hyphen which creates a range.
  • It's an error if:
    • It's creating a range between tokens in reverse character index order (e.g., z-a, @-!, \uFFFF-\b, or \127-\cB).
    • It would otherwise create a range, but it's followed or preceded by a token which represents more than one character index (e.g., \d). In fact, in some cases browsers take this to mean that the hyphen should be treated as a literal, but browser bugs cause it to be handled inconsistently so RegexPal flags it as a range error.

Here are a few more things which aren't errors but are flagged as such:

  • Empty, top-level alternation, except at the end of the pattern, where such an alternation is ignored when highlighting matches in order to create a less surprising experience while the user is in the middle of constructing the regex. Empty, top-level alternation is flagged as an error because it effectively truncates the regex at that point (since it will always match). If a zero-length, top-level alteration is really needed, there are other easy ways to do that more explicitly.
  • Lookaround quantifiers (e.g., the plus sign in (?!x)+). This would be an actual error with some regex libraries (e.g., PCRE), and although that's not the case in most web browsers, such constructs add no value. As a result, RegexPal flags such quantifiers as an error, since they are almost certainly a user mistake.
  • \c when not followed by A–Z, \x when not followed by two hex characters, and \u when not followed by four hex characters. Although these do not cause most browsers to throw errors, they are handled inconsistently cross-browser and are hence flagged as errors. They would almost certainly be a user mistake even if the cross-browser issues didn't exist.

Credit to osteele.com from where the text of the short-and-sweet Quick Reference is based, and to RegexBuddy from JGsoft for inspiring many of RegexPal's features. The name RegexPal is, in part, a nod to RegexBuddy, but also selected because it contains both "regex" and "regexp." wink

There Are 149 Responses So Far. »

  1. I loved as much as you’ll receive carried out right here.
    The sketch is attractive, your authored subject matter stylish.
    nonetheless, you command get bought an nervousness over that you wish be delivering the following.
    unwell unquestionably come more formerly again since exactly the same nearly very often inside case you shield this increase.

  2. However, DHEA has not been effective for improving body composition in women
    or in other studies of men. Although some of the alternative health practices have been found to be
    helpful in the treatment for HIV and AIDS, none have been
    proven thus far as a singular treatment for the virus. Go to You
    Tube and place “ARP Therapy” in the lookup window.

  3. Attractive section of content. I just stumbled upon your weblog
    and in accession capital to assert that I acquire in fact enjoyed account your
    blog posts. Anyway I will be subgscribing to your feeds and even I
    achievement you access consistently rapidly.

  4. Hi!

    Nice site, but just one comment to make it even better šŸ˜‰ It does not work with regexp lookadeah and lookbehind … I just spent and hour figuring something out and than I found that it’s only not working on your site šŸ˜‰

    Regards,
    Jernej

  5. Iā€™m not that much of a internet reader to
    be honest but your sites really nice, keep it up!

    I’ll go ahead and bookmark your site to come back later.
    Many thanks

  6. I ej?y reading a post that will make people think.
    Also, thank you for allowinjg fo?r m? to comme?t!

  7. 4) One cup of Campbell harvest light soup of a roasted chicken with
    Italian herbs is also a nice example of a healthy snack list.
    Finally, you will find that it is not appropriate for you to order oatmeal when you
    are out in a restaurant because you will never know if it is pure or not.

    I didn’t add any extras like Xantham gum, and didn’t have any failures.

  8. Hi there to all, the contents present at this web site are really amazing for people
    experience, well, keep up the nice work fellows.

  9. Very quickly this site will be famous amid all blogging and site-building
    viewers, due to it’s good articles or reviews

  10. If you are going for best contents like myself, simply pay a
    viisit this site all the time as it provides quality contents, thanks

  11. hey there and thank you for your information ā€“ I’ve certainly picked up something new from right here.
    I did however expertise several technical points using this site, as
    I experienced to reload the web site a lot
    of times previous to I could get it to load correctly.

    I had been wondering if your hosting is OK? Not that I am complaining, but sluggish loading instances
    times will often affect your placement in google and could
    damage your quality score if ads and marketing with Adwords.
    Anyway I am adding this RSS to my email and could look out for a lot more of your respective exciting content.
    Make sure you update this again soon.

  12. This music device use only MP4 audio files that are readily available in i – Tunes(TM).
    The soft, flexible sleeves on these are able to mold
    to your ear shape and therefore create a seal around the
    ear. Bose has learned from these failures and has
    provided the consumer with earbuds that sometimes don’t even feedl like they are budding in
    the ear.

  13. I like the helpful info you provide in your articles.
    I’ll bookmark your blog and check again here regularly. I’m quite certain I will learn many new stuff right here!
    Good luck for the next!

  14. Superb blog! Do you have any tips and hints for aspiring writers?

    I’m hoping to start my own site soon but I’m a little lost on everything.
    Would you advise starting with a free platform like WordPress or go for a
    paid option? There are so many choices out there that I’m totally confused ..
    Any tips? Thanks a lot!

  15. Thank you for the auspicious writeup. It in fact was once a
    entertainment account it. Look complicated to far added agreeable from you!
    However, how can we communicate?

  16. Its like you read my thoughts! You appear to know so much about this, like you wrote
    the guide in it or something. I think that you could do with
    some p.c. to power the message home a bit, but other than that,
    that is wonderful blog. An excellent read. I will certainly be back.

  17. Fantastic goods from you, man. I’ve keep in mind your stuff previous to and you are just too excellent.

    I really like what you have bought right here, certainly like what
    you’re stating and the way in which during which you
    say it. You make it enjoyable and you still take care
    of to keep it smart. I can not wait to learn much more from
    you. This is actually a wonderful website.

  18. You actually make it appear so easy with your presentation however I to find this matter to be actually something that I
    think I might never understand. It kind of feels
    too complicated and very wide for me. I’m having a look forward on your next publish, I will try to get the cling of it!

  19. Hey there! I could have sworn I’ve been to this blog before but after reading through some of the post
    I realized it’s new to me. Anyways, I’m definitely glad I found it and I’ll
    be bookmarking and checking back frequently!

  20. This web site really has all of the information I needed about this subject and didn’t know who to ask.

  21. I every time spent my half an hour to read this blog’s content all the time along with a mug of coffee.

  22. Hello, I enjoy reading all of your post. I wanted to write a little comment
    to support you.

  23. Hello, i feel that i noticed you visited my website so i got here to go back the want?.I am attempting to in finding things to improve my
    site!I suppose its ok to use some of your ideas!!

  24. Hi my loved one! I want to say that this article is awesome, nice
    written and come with approximately all vital infos.
    I would like to see more posts like this .

  25. Greetings from Carolina! I’m bored to tears at work so I decided to check oout your
    blog on my iphone during lunch break. I love the info yyou provide
    here and can’t wait to take a look when I get home. I’m surprised at
    how fasst your blog loaded on my mobile ..
    I’m not even using WIFI, just 3G .. Anyways, excellent blog!

  26. Wonderful goods from you, man. I’ve understand your stuff previous to and
    you’re just too great. I actually like what you have acquired here, really like what you are stating and the
    way in which yyou say it. You make it enjoyable and you still take care
    of to keep it wise. Ican not wait to read far more from you.
    This is actually a great website.

  27. The web has truly changed the way we communicate and made it far easier to stay informed about
    the lives of our loved ones. A VPN creates an encrypted connection to a third-party server, and all your Internet
    traffic is routed through that server. Make certain that the payment gateway you are making use of, permits similar languages as the remaining
    of the web pages so that they can match well together.

  28. Each new age brought the criminal element forward with it.

    The says of free proxies and tunnelling services are over, and as the Chinese government begins to tighten its grip on what comes
    in and out of the country informationally speaking, the need for a vpn to bypass internet censorship in China grows every day.
    Efficiency: Many carriers provide multiple receive emails, so your fax messages are automatically delivered to whomever you
    intend.

  29. Pretty part of content. I just stumbled upon your site and in accession capital to say that
    I acquire in fact enjoyed account your weblog posts. Any way I’ll be subscribing for your augment and even I fulfillment you access constantly
    rapidly.

  30. One of the questions we frequently get asked is why not just use Skype.
    Hoje em dia, podemos optar entre muitos tipos de suporte.

    Besides fixing runtime error R6016, it will
    remove any registry errors, invalid shortcuts, duplicate files and repair
    no matter EXE or DLL files, like Psapi.

  31. I read this paragraph fully about the difference of latest and previous technologies, it’s amazing article.

  32. I read this article completely about the resemblance of most up-to-date and earlier
    technologies, it’s awesome article.

  33. Every weekend i used to pay a quick visit this web site,
    because i want enjoyment, since this thus web site conations in fact good funny
    information too.

  34. I will immediately grab your rss feed as I can’t find your e-mail subscription hyperlink or newsletter service.
    Do you’ve any? Kindly permit me know so that I could subscribe.
    Thanks.

  35. I’m gone to say to my little brother, that he should also go to see this weblog on regular basis to obtain updated
    from newest information.

  36. I’m really enjoying the design and layout of your website.
    It’s a very easy on the eyes which makes it much more enjoyable for me
    to come here and visit more often. Did you hire
    out a developer to create your theme? Great work!

  37. Test expression:beg.+n

    Given statement:begun begin beguin begn

    in answer begn was also selected. How come begn is selected?
    beg.n means begin,beg3n,beg.n,begun
    beg.+n means begin,beg3n,beguin
    Then how come begn is selected here

  38. For hottest information you have to visit internet and on the
    web I found this website as a best site for hottest updates.

  39. I started “swimming” the middle of my sophomore year in high school and i got
    more serious into through my junior year, and now that it’s my senior year I joined my local club team and I’m in the water anywhere from 2 4 hours a day,
    doing about 6 12k yards. When i started swimming i was about 5′ 3″ and 128 pounds. The Log of the Bounty, and of the open launch boat in which Bligh and the loyalists in his crew were set adrift by Fletcher Christian and his mutineers is compelling reading, especially rocking in any sailing vessel berth over salt water, out of sight of shore. Last spring, some adventurers re traveled the remarkable 3600+ mile journey sailed by Bligh in that small boat, in similarly small, open sailing boat, with as minimal navigation resources and supplies as Bligh’s log described, with a few modern electronic links to permit crew monitoring and position reporting.. cheap ralph lauren polos
    ralph lauren sale uk ralph lauren outlet uk ralph lauren outlet ralph lauren outlet

  40. Steve, how does this page work? I pasted a rule into the first box and then a few lines of example text in the second box. Nothing happened. Is there a “Go” button of some sort? Thanks.

  41. My regular expression is “1|10”, so, the words that accept are:
    1
    10

    But, this RE does not accept the part second “10”, ie,
    10

    But, if my regular expression is only “10”, if accept the word:
    10

    Are you suggestions?

    Thanks,
    Jose

  42. This tool is worth its weight in gold. Props to the devs. Thanks for making my life easier and my regex more efficient!

  43. I am asking for help in writing a regular expression to shorten this expression. I need the string below to search every interface within the range of 1 -24 to validate the configuration. If one interface does not have the required configuration then the expression fails.

    interface GigabitEthernet1/***1-24***.\n(.\n). description ** Unused Port **.\n(.\n). switchport access vlan 333

  44. Some of the most active marketplace occasions will happen when two or extra Industry Centers are open at the identical time.

  45. Liquidation of LTD (liquidation) http://aivex.ru/art.likvid.ooo.html Why do business owners there is a need to close the company? The reasons are different. Thus, the entrepreneur finds alternative way of obtaining income, or simply can’t compete in the market. The growth of payables to contractors and public funds can also cause the liquidation of the company. Often the reason for the closure of the legal entity becomes the current economic situation in the country. Any economic crisis is forcing entrepreneurs to optimize their costs. Some, adopting effective measures to survive, but many are forced to liquidate LLC.

  46. Liquidation of LLC debt http://aivex.ru/art.likvid.sdolgami.html if the founders and Executive bodies of legal entities are operating incorrectly, the company had debts. Moreover, the reasons of occurrence of debts of a legal entity are different. Perhaps Society had debts to the budget or funds to counterparties, it is possible the company is simply not passed under the legislation reporting or otherwise to prevent the formation of debt.

  47. Official liquidation http://aivex.ru/art.likvid.ofic.html what is the liquidation of the legal entity, its major causes and types we wrote on our website before (Liquidation of limited ). In order for You to understand the essence of the liquidation process of the organization, I advise You to study this article. What is the official liquidation of the legal entity, its difficulties and peculiarities and also about when it is possible to apply talk in this article. So, to choose a formal liquidation of the LLC can be subject to ALL terms:

  48. Elimination through change of the Director and the participant
    (alternative liquidation) http://aivex.ru/art.likvid.alternativ.html Sooner or later the business owner thinks about the possibility of closing their business. Why owners of the firms make such decisions? The reasons are different. It could be the unstable situation in the country, and the lack of the need to carry out business activities, growing payables, etc. Our company can professionally help You in such an important matter as the liquidation of firms On our site You can learn including about what a liquidation of the company, as are the stages in official liquidation. First we need to decide on the election of the method of liquidation of your legal entity. What are the features of the alternative procedure of elimination?

  49. Monitoring procedure http://aivex.ru/art.bankrot.nablud.html Upon receipt of a Declaration of bankruptcy the Arbitration court, perhaps the introduction of monitoring, this capability arises from the moment of adoption by the Arbitration court of appeal on the recognition of the company bankrupt. The monitoring procedure applies to the debtor company to guarantee the safekeeping of property of the debtor’s business, to study the economic condition of the debtor, to conduct the first meeting of creditors, the preparation of the register of requirements of creditors etc.
    The supervision procedure provided by the law of the Russian Federation which indicated future activities of the organization, as well as employees of the debtor. These standards also apply to the activities of the accounting Department.

Post a Response

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