Regular Expressions deciphered using RegexBuddy, Regexpal and rexv.org

Regular Expressions deciphered using RegexBuddy, Regexpal and rexv.org


Hello everyone! This is Zathrus Writer and
after an awfully long pause it’s time to refresh this channel a little. Today, I’d like to talk a little bit about
regular expressions. You know, the little pieces of mostly unreadable code that even
a seasoned programmer can have hard time decrypting from time to time.
Still don’t know what I mean? OK, here’s a nice example of validating RFC822 email addresses… If this does not ring a bell, then don’t worry
– we’ll talk about how to learn to use regular expressions as well today. And that’s even
learning such monsters as this “little” piece of code 😉 For those who don’t know, regular expressions
are specially written commands that are capable of searching in an arbitrary text.
For instance, you can search for text “hello dolly” and “hello dollies” by using this little
piece of code: hello doll(y|ies) As you can see, the text hello doll is written
in plain text, followed by a certain regular expression. This expression programmaticaly
tells the computer to find the literal text hello doll, and then search for either
the letter Y or letters IE and S that immediately follow this text. This will become more visible
in a minute, as we’re getting to the fun part of this video. As you can also see, reading what text are
certain regular expressions trying to search for can sometimes be more than frustrating,
if not straight impossible. Fortunately, there is a very nice application
to aid you in this process. This application is called RegexBuddy, and at the time of making
this video is only available for the Windows operating system. This is not a free application and does not
exactly cost little for the ordinary guy. However, that’s not to say that the price
does not reflect quality of this program. I would actually go as far as saying that
RegexBuddy is by far and wide the best regular expressions oriented application there is.
In the world. In the know space! In the unknown space for that matter!
OK, I’m guessing we’re deviating from the script now, so let’s get back to the application. RegexBuddy costs at the time of writing this
review 29.95 Euros, which is about 24.04 British Pounds, if anyone is interested.
There are of course various multiuser, combined and upgrade options available. Although I
didn’t see any discounted, academic or elderly people licences on the website, which would
probably suggest that all human beings either under or over certain age might not be capable
of reading pixels on the screen correctly or something – I don’t know. Directly on the website itself, you can find
nice and rather short explanation about what regular expressions are, how RegexBuddy will
make reading and writing them easier and even listen to the sleeping voice of presumably
RegexBuddy author himself, talking us through his little tutorial video. The website also promises that upon purchase,
you will also get a PDF and Windows Help version of much more detailed version of regular expressions
walkthrough. I can of course tell you that this claim is completely correct,
as I’ve not found a better or more detailed explanation of regular expressions anywhere
on the Internet – be Google my eternal witness! Upon starting the program, you might be surprised
how much energy must have gone into creating RegexBuddy itself. The interface is simple,
yet intuitive and more importantly – the number of options available for you in this
application is quite outstanding! Just comparing various regex engines to create a help system
that will tell you the differences between multiple languages and the way they handle
certain expressions must have been immensely overwhelming – yet the author did just that
to help us out! The more I use RegexBuddy, the more I’m starting to appreciate the fairness
of the actual price asked for it. But of course, this dropdown menu does not
contain all the languages, engines and their versions. This is just a most used representation
of languages and the dropdown itself can be customized to show whatever regex flavour
your heart desires! Hell, you can even create your own and adjust the various search, replace,
compare and snippetting options! From version 3, RegexBuddy also contains an
interesting switch between Helpful and Strict parsing modes. Before this version, Strict
was the only mode supported and if you worked with an expression which would be parsed differently
in Java than in JavaScript, the parser would just do so and you might end up banging your
head against the table due to the unexpected results. On the contrary, Helpful mode is
basically a hinting mode. When such a circumstance happens that would be parsed
differently in multiple regex parsers, Helpful mode will instead warn you that this functionality
differs between parsers. When you double-click this information, RegexBuddy will also
attempt to correct this for you. As I said before, creating regular expressions
is dead easy with RegexBuddy – if you are starting with them that is. Otherwise the
interface and dropdowns would just get in your way and you could as well type the whole
regex into the correct window. And while these dropdowns
are all cool and dandy, and for the most part self-explanatory, you probably end up not
using them at all once you get the grip of regexes. The interesting part is, however below these
dropdowns – and that is the actual explanation section. Even with the most ridiculous regexes
you can immediately see what that regex and its parts do and possibly update it, if your
boss keeps insisting on that. If you’re ever stuck, there is the Explain Token button which
will automatically open the Windows help in the right section for the highlighted regex
part. You can even compare multiple engines between
each other in this view to see what the differences between them would be for the regex created.
This is immensely useful when creating regular expressions that are to become a public domain,
and thus need to be as language-agnostic as possible. For a better feeling, there is the option
to export these explanations into various file formats as well. As long as the top bar goes, there is the
expected double-dropdown combo of case sensitivity and multiline handling, the possibility of
match, replace or even split the test string into a list, copy and paste commands, options
and help. An interesting feature of RegexBuddy is definitely
the Convert tab. This is very usable exactly in the case of someone posting a regex in
C#, while you need that same exact thingy for a JavaScript parser.
No problems, the Convert tab will do just that for you. To actually test the regex you created, you
will definitely need to use the test tab. This is a multiline area which very nicely
highlights all matches that your regular expression will catch with the option to highlight only
some of them or none at all. Probably more for learning purposes and also
to see how the parser gets the result you see in the test tab, you can open the Debug
tab and study away. This tab is definitely usable during the learning curve, so I would
recommend not to skip it in such case. Finally, if you want to use your regex, the
only thing you need to do is visit the Use tab, where multiple usage options will be
presented to you, considering the flavour you selected and the search or replace functionality
that is needed. For a good measure, there is also quite a
handy Library which contains the most often used regexes for you to reuse, so you don’t
have to always search for them on the web. You can, of course add your own, making this
tab a really nice snippet repository. Last but not least, there are the GREP and
Forum tabs which I never used before, and thus I won’t share any knowledge about them
here. GREP, as name suggests, is capable of iterating over multitude of files and probably
even replacing the text found by the regular expression
in them. How does this differ to the other featured product from the same author – PowerGREP
– I have no idea and if you need this functionality, you’re better off learning this
on your own here. The Forum tab did not seem to do anything for me, even after trying to
search for something, so that remains another black hole for me there. If you are interested, you can also utilize
the history pane – which can be really quite useful – as well as update millions of options
in the options menu. For me, I could live without these so far, but you might want to
adjust some of them, like tabs and spaces, so copy-pasting
of code will match your or your company’s coding standard – if it doesn’t already do
so. An interesting option is to create a portable
version of RegexBuddy on your portable media, although I’ve not used it, as I didn’t want
my entire hard drive erased in case that’s what this option does. But it’s nice and it’s
there for you. In case you can’t quite afford RegexBuddy
or prefer online solutions, there are at least 2 alternatives that I can point at.
The first one is regexpal.com which is a JavaScript regex parser only that looks and behaves quite
a lot like RegexBuddy, albeit with very limited features.
Next one is RexV.org that has a different user interface, is a little bit slower, as
it does regex parsing on the server side, but also contains more options, some nicer
help and a few more languages. Whatever you shall choose, I hope this video
made your regex journey a tad more enjoyable and I’m looking forward to any comments or
suggestions you may have! Until we see each other again, have a great
day and… adios!

2 Comments

  1. Stan Woods says:

    A very nice free tool with similar basic capabilities is Expresso which can be found at http://www.ultrapico.com/

  2. Layarion says:

    your noise gate on your microphone or something to too strong. makes it hard to understand everything.

Leave a Reply

Your email address will not be published. Required fields are marked *