RegExr is a free website to learn about Regular Expressions. It lets you learn various type of regular expressions easily. It also lets you test the regular expressions that you have created.
When you go to this website, you will see a box in which you can enter the regular expression that you have made. Also, there will be a box below that in which you can type the text on which you want to test that regular expression. If your regular expression matches any text in that, the corresponding text will be highlighted. In this manner, you will be able to quickly evaluate your regular expressions.
This website also provides you lot of examples for regular expressions that you can use and learn from. Let’s say you are looking for a regular expression for a phone number; you can easily get them from this website and test them on your text.
Apart from learning regular expressions, you can also use this website as a tool to test your regular expressions on the fly. Let’s say you have built a complex regular expression and you want to see whether it works fine or not. In that case, you can just go to this website, input your regular expression, input the sample text on which you want to try that, and this website will instantly show you the text snippets that matched your regular expression. If something doesn’t looks right, you can change the regular expression in the website itself, and see the results on the fly. And if the things don’t look promising even then, then just hit its vast library to find the regular expressions you need.
And the features of this website don’t just end here :) It actually comes with a find and replace option as well, so that if some part of your sample text matches the regular expression, you can choose to change that with any other text. And of course, you can use regular expressions for substitution too :)
The best part is that you do not need to download anything and neither create any account. Just go to the homepage of this website and start regexing (I don’t think that’s a word, but you get the idea).
A Regular Expression is series of letters, numbers, and characters that can be used to implement advance search in a text file. Applications of Regular Expressions are close to infinite, from finding a simple word in a text file to checking whether the user has entered a properly formatted Email address or not. You can check more about technical utilities of Regular Expressions here.
Beginning with RegExr to Learn Regular Expressions Online:
You can follow the link given at the end of this review to reach RegExr. It doesn’t require any registration or sign ups, and you can start using it right away (personally, I love this feature). Before I tell you how we can use RegExr for learning, let’s see what has it got.
Interface of RegExr:
- Main interface offers you two panels, namely: Text and Expression. The Expression Panel is the text box where you need to enter regular expression to be searched, and the text in which it is to be searched is entered in the Text Panel. You can also drag and drop text files here a well.
- At the bottom of Text Panel, you have the Substitution Panel. You have to click on it to open. It offers you a text box, where you can enter the characters that will replace characters searched in the text. Substitution can be done with regular expressions or simply text. You also get the preview of the substitution here.
- On the left of Text Panel, you get the Library option, which has further options like: Help, Reference, Example, Community, and Favorites.
- On the right-top corner of Expression Panel, you have three options: Share, Save, and Flags.
Using RegExr to Learn Regular Expressions Online:
Using this website is actually pretty simple. Just enter the text and your expression and the search results for it are highlighted. It’s pretty easy to use if you are well versed with regular expressions. However, if you are a fresh learner, the following pointers might come in handy:
- A sample text is available in the Text Panel. You can start test on it or drop a text file on the text panel.
- You can then go to the References in Library and choose from options (or tokens) like: Character Class, Anchors, Groups & Lookaround. For every token you choose, you’ll get a brief note on its use and example (both Expressions and Text). To implement the examples, you just need to click the respective Arrow Button. This will search add the regular expression to Expression builder on right (the textbox in which you have been entering regular expressions till now).
- You can try “Example” option, if you are looking for some definite patterns, like: integers, phone numbers, 4-letter words, Panindrome etc. Just like reference, you get examples for both expressions and text with it.
- You can also choose the “Substitution” option in the References, which help you replace the patterns in the text. Reference carries some substitution tokens as well.
- Like most of the learning tools, RegExr also requires practice to understand it better. Once you are comfortable with these pre-defined structures, you can also build and test your own expressions.
Other Features of RegExr:
You can save and name the text, and share it on various social platforms. For that, simply click on the Save option at the top-right corner of Text Box.
The Save option on RegExr means that you can generate the link and use it to return again on the same text. You can share the link with your friends, colleagues etc. as well.
Tutorial video of this website mentions that links remain active only for 24 Hours since the last save. So, I suggest you keep a copy of expressions and text.
RegExr is quite an amazing webapp, when it comes to learning Regular Expressions. With features like References and Examples, it makes it quite easy to learn Regular Expressions. The testing and building part is fun as well.
All in all, I’d say that if you want a free and fun way to learn Regular Expressions, do give RegExr a try.
Did you use RegExr? Do let me know in the comments below.