Hi everyone. I originally released this screencast back when this blog only had about two hundred subscribers. Lately, many of our new readers have been asking me about using regular expressions. So, I decided to bump this one back to the top. I hope you enjoy it!
To a novice web developer, regular expressions look like the most scary thing on the planet. Who could possibly dismantle such a block of code and decipher its meaning? Luckily, its bark is much worse than its bite. You’ll quickly find that regular expressions are rather straight-forward and easy to understand - once you learn the syntax.
Click on the “Toggle” to view the video in full screen.
Additional Resources
-

Regular Expressions Cheat Sheets
Whether you’re searching strings or validating input fields, the use of regular expressions will save you a great deal of time. I found a great cheat sheet from AddedBytes.com that should save you a great deal of time. It’s a free PDF download, so get to it!
-

Using Regular Expressions with PHP
This site specializes in all things related to “regular expressions”. It should be your first stop on your learning question.
-

PHP Regular Expression Tutorial
Regular expressions are a powerful tool for examining and modifying text. Regular expressions themselves, with a general pattern notation almost like a mini programming language, allow you to describe and parse text. They enable you to search for patterns within a string, extracting matches flexibly and precisely.
-

Using Regular Expressions with PHP
In this article I will show you how to use PHP regular expressions in your own PHP scripts.




tripdragon
November 18th, 2008
Bad choice in pictures for open
Balron
November 19th, 2008
Nice tutorial, thanks
Midday
November 21st, 2008
thanks for the nice tut, explained everything
at the part where the regex for email addreses is done there a missing $ sign at the end,…
so it not only will valitate “sitemanager@themeforest.net” but also “sitemanager@themeforest.net something else here” ??
here some examples which would be valid email addresses but invalid acording to the used regex,…
email@some-site.com
email@blog.somesite.com
email@somesite.co.uk (same ideea as above)
i think this would be a better regex for emails,.. please correct me if im wrong
\^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$\
Juan Barrientos
November 22nd, 2008
Nice!
Abethebabe
November 23rd, 2008
Jeff, I really love your screencasts, you’re really good at explaining things!
Keep up the good work
igmuska
January 20th, 2009
Another excellent video tutorial clearing up my confusion over Regular Expressions. I have “Mastering Regular Expressions” by Friedel and got lost somewhere in there. You have opened another door for me. Thanks
Parlian
February 9th, 2009
It is such a relief to have discovered your tutorials which do improve my learning curve drastically
George Hennessy
February 20th, 2009
Outdated tutorial.
JerOpp
February 25th, 2009
Another great eye opener.
Thank you very much.
Meshach
June 8th, 2009
Thanks Jeffrey, I was making a contact form today and this came in handy.