Jump to content

(How to) Create, verify and visualize regular expressions with iHateRegex


Karlston

Recommended Posts

Create, verify and visualize regular expressions with iHateRegex

Regular expressions, or regex, can be very powerful when it comes to find operations provided that programs or online services support them. Programs like TextConverter, PowerRename, or nnn support regular expressions, but using regular expressions can be intimidating or outright frustrating.

 

Take the following expression as an example: (25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}. If you are familiar with regular expressions, you may understand the expression right away. If you are not, you may have a hard time deciphering it (it detects IP addresses).

 

Crafting regular expressions can be very frustrating especially for users who just started to learn regular expressions.

 

The new website iHateRegex comes to the rescue. The site maintains a searchable database of regular expressions and includes a playground for testing regular expressions.

 

regular-expressions-tester-1.png

 

The search field on the project's startpage can be used to search the database of regular expressions. Select any to display the expression, example matches, and a visualization that highlights the expression's flow.

 

You can edit any of the regular expressions or example strings right away; results and the visualization are updated in real-time and it is quite easy to use the visualization and the matches to craft and verify regular expressions.

 

The playground works identical only that you are starting with a basic regular expression and visualization that you may modify to your liking. You may copy the expression or copy embed code, and even submit a new regular expression for evaluation and inclusion in the project's database.

 

Since you may edit any regular expression, you may also use copy and paste to copy regular expressions from other sites or applications to paste them on the iHateRegex site; this way, it is easy to edit, test and verify regular expressions.

Closing Words

There are plenty of sites on the Internet and programs that help understand, create and verify regular expressions. We reviewed the Windows software Regular Expression Coach in 2009 and it works to this day.

 

If there is one downside to iHateRegex it is the fact that you cannot just use the site if you are getting started. You need another resource such as Regexr or regular-expressions.info to learn the basics quickly. It would be great if the developer of the site would add some tutorials and quick help options to the site to assist users.

 

 

Source: Create, verify and visualize regular expressions with iHateRegex (gHacks - Martin Brinkmann)

Link to comment
Share on other sites


  • Views 1k
  • Created
  • Last Reply

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...