Tuesday, February 1, 2011

Regular Expressions - Resources, Samples, and Regex Information

Regular Expression Books

Regular Expressions are a really powerful, useful, and precise means for matching strings of text via a given pattern. They are also referred to as regex or regexp. If you have been doing any kind of development, front-end or back-end, you have probably used or seen them in action. In the front-end world, form validation comes to mind right away, but there are many uses, and it's a good idea to have some fundamental knowledge about regular expressions.

In this article I will try to provide some of the best links to resources available on the internet for regular expression tutorials, tools, patterns, and regex information. I hope it will be helpful to anyone that wants to learn more about regex or someone that is just looking for a pattern for their code. If you prefer to read a real book instead of looking at online text, I would definitely recommend Mastering Regular Expressions by Jeffrey Friedl.

As a start, I think a good place to begin learning about regular expressions is glancing at the wikipedia regex entry. Wikipedia gives you a good overview of basic concepts, history, and some good regular expression patterns and metacharacters to remember. After you have this overview, the best place to learn about regular expressions online is definitely the regular-expressions.info website. Most people that work with regular expressions daily always recommend this site as a super informative resource. Also, while you are getting introduced to regex, download a regular expression cheat sheet.


Learning Regular Expressions



If you are looking for more explanations on why and how things work in the world of regex, I would recommend these links:

How to Regex

Mastering Regular Expressions

PHP Regular Expressions

Regular Expressions for SEO


Learning Regular Expression Patterns and Samples



Most people don't really want to learn regular expressions but they are searching for a pattern for their code and need a good resource to find good regex samples and examples. The obvious problem with that is that you are just taking a guess that the pattern is good without really knowing what you are doing... but these resources are really good and provide many patterns with explanations and helpful descriptions. Also, looking at these patterns can help you learn more about regular expressions:

Regex Patterns

JavaScript Regex

Regular Expressions for Web Developers

Intro to PHP Regex

Programming Regular Expressions

Password Strength Regex

URL validation via Regex


Online Regex Testers



While you are reading about regular expressions and browsing through patterns, you probably want to try some of these yourself. Well, there are many options, you could write a quick regex tester yourself in PHP, JavaScript, or whatever language you are most comfortable with, but why not just try one of the many online regular expression tools available on the internet. Here is a list of great regex online editors (most of these have some good information and sample patterns that you can test out for yourself):

gSkiner RegExp

Rubular

RegTest Tester

Regex Pal

Regex Editor

Regex Tool


Finally, if you are looking for even more links and information on regular expressions, I think these two articles do a good job on giving you extra resources:

Essential Guide to Regular Expressions

You don't know anything about Regular Expressions

2 comments:

  1. I should add Rejex to the list of online regex testers because it is just perfect with a good reference.

    ReplyDelete
  2. another good resource: http://www.boost.org/doc/libs/1_31_0/libs/regex/doc/syntax.html

    ReplyDelete