Regex: What it is and 3 Sources to Learn More

December 13, 2014

2:00 pm

Regular expression, also known as regex, regexp or even rational expression, is something that many people might not know but can actually be very useful. regex is a sequence of characters that forms a search pattern or, in more colloquial terms, wildcards on steroids.

For example, the most used expression to search all text files in a file manager is *.txt, which basically means that the file manager will return all the files with a .txt extension, whatever their name is (hence the *). With regex, that expression would be .*\.txt$.

But, in fact, there is much more that can be done with regex, if you know how. Let’s take a look at three great sources to look for more information and tutorials on how to use regex and, therefore, improve the effectiveness of your searches.

Regular-Expressions.info

Some domains really show what a website is all about, and this is entirely the case. Regular-Expressions.info is a website to get information on regex, with many different sections to check. The site offers tutorials for several levels of regex proficiency, from a “Regular Expressions Quick Start” one to “Replacement Strings Reference”, that is way more tricky.

There is even a 300-page PDF dedicated to Regular Expressions, available for download if you make a donation of $4.99 or more through PayPal or Bitcoin.

Setupablogtoday.com

Even though this website is more dedicated on how to create blogs in record time, Setupablogtoday.com also offers a very complete and interactive regex Cheat Sheet. It contains information on several different expressions, like Anchors, Character Classes, Pattern Modifiers and so on.

For each item you can find a brief explanation of what it is and what it does, as well as all the syntax within each category. This is an excellent go-to source whenever you need a quick and uncluttered way to check syntax and how something works in regex.

Python.org

This should not come as a surprise, but Python does have a module for regex. Called re, this module was added in Python 1.5, and provides Perl-style regular expression patterns. It replaced another module called regex, which came in earlier versions of Python and provided Emacs-style patterns.

In a tutorial from Python.org you can learn how to utilize the re module, which merges the best of two worlds: the handiness of regex with the simplicity and effectiveness of the Python programming language.

Tags:

Did you like this article?

Get more delivered to your inbox just like it!

Sorry about that. Try these articles instead!

25 y/o, born and living in Portugal. Majored in Biology, but tech and computers were always a passion. Wrote for sites like Windows.Appstorm and MakeTechEasier.

Leave a Reply

  • (will not be published)
Startup_Mixology_300x250