Sunday, April 5, 2015

You Should Learn Regular Expressions

Post Type :

Regular Expressions, or RegEx, are used for searching patterns in text. For instance, a RegEx like iP(hone|ad|od)s? will find mentions of any iOS device in a document. Knowledge of Regular Expressions is essential for programmers but they can be a great skill to have for non-developers as well – people who use Microsoft Word or spend hours inside Google Spreadsheets.

RegEx in Microsoft Word

Why Learn Regular Expressions?

Regular Expressions are extremely powerful, and no less intimidating, but even basic understanding of RegEx will save you time and make your everyday computing tasks easier.

For instance, you can quickly find & replace text that matches complex patterns in Word or Vim. You can easily extract phone numbers and emails in spreadsheet cells using regex formulas. If you are creating a form in Google Drive, RegEx can help you define validation rules for user input. You can use RegEx in Gmail and Google Analytics too.

How do you learn Regular Expressions? Or, if you are already familiar, how do you take your RegEx skills to the next level? You will obviously learn by doing but there are some excellent tools and learning resources on the Internet that will take make your journey to knowing Regular Expressions more pleasant.

The Best RegEx Tools & Resources

Lea Verou’s presentation will give you a good overview of what Regular Expressions are and what you can do with them. Jeffrey Friedl’s book – Mastering Regular Expressions – is still the best printed reference for RegEx newbies and masters. You can explore RegexOne, an interactive Codecademy-like online tutorial for learning RegEx or go here for learning the basics of pattern matching.

Highlighting all the non-English characters

Highlighting all the non-English characters

RegExr is like a visual playground for Regular Expressions. You enter the text in one block and the RegEx in the other. As you edit the RegEx, the matching strings are highlighted in the input text. You can also hover over any character literal in the RegEx to know what it does. RegEx101 is a similar tool that also describes your RegEx in English as you write.

Regulex and RegExper are both open-source web apps that make it easy for you to understand and read Regular Expressions. You enter a RegEx and the tools will create a Railroad Diagram – for a string to match, it should be able to successfully move from left of the diagram all the way to the left along one of the available paths.

RegEx Visualizer

Windows users can download Expresso, a free program that will help beginners write both simple and complex regular expressions through a visual builder. Instead of coding the RegEx manually, you can select the components in a wizard. Reggy for Mac and RegEx Coach for Windows can also help you test regular expressions outside the browser.

Also see: How to Learn Coding

Once you understand the basics, head over to RegEx Golf or play this RegEx Game to test your skills. Like with everything else, you’ll only learn Regular Expressions by practicing and mere reading won’t be sufficient.


The story, You Should Learn Regular Expressions, was originally published at Digital Inspiration by Amit Agarwal on 03/04/2015 under Code, Internet.

View article...

No comments:

Post a Comment

Related Posts Plugin for WordPress, Blogger...