See also: Heapify

Go back to post Create new comment

RSS Be notified of new comments on this post with the RSS feed for this post.


Excellent post. Until now, I tried decrypting reg ex with no success at all. This post clears out the basics to understand all the reg ex used.

Thank you very much, Krishna


there is no backslash in the first example of where to use a backslash


Thanks for writing this! It was very helpful and easy to read.


Great introduction tutorial!!!

It is difficult to find any clear regex tutorials for beginners.

This helped me understand the concept much better.


You sort-of infer that regexps are good for validating an email address, but I would caution you that this is quite a bit more complex than /w+@w+.w+/ .

See Jeffrey Friedl's book for more info.

Just another Perl hacker,



The hot topic of proper E-Mail validation!

I would like to see more about the limitations of regular expressions. Particularly when applied to computability theory. I.e. what can regular expressions mathematically do easily and where do they fall apart? What other data recognition and decision processing methodologies are there that compete with Perl style regular expressions? What methodologies improve on perl regular expressions, if any?

Perhaps these are questions for a later post. I'll hound you until I get some discussion about this or until I get some time to write up a discussion on the maths & technical side of regular expressions myself!

In any case, nice primer ben. Looking forward to part 2!


thank you so much!

i look forward to part 2


I think you've got some of your character classes confused. I believe \A matches non-alpha characters and you state it matches alphabet characters. Ditto for \S. The capitalized versions match the opposite of the lower case, so \s matches white-space.


is there a pdf version of the first part of this article? I can only find a pdf of the second part.

It's a great article and is perfect for someone like me who uses regex only sporadically - handy to have as a reference.


Go back to post

Create a new comment

Go to the top

You can use a restricted version of markdown formatting here. You can use the toolbar above the text field to make this more painless. For more information about markdown please refer to the markdown cheatsheet.

For post: Regex tutorial for people who should know Regex, but do not.. Part 1
Your name:
Your email (optional):
Your website (optional):

A preview of your comment:

Powered by Debian, Guinness, and excessive quantities of caffeine and sugar.