1. Technology

Regular Expressions



Regular expressions allow you to 'pattern match' strings of text. The syntax of regular expressions let you do this in a very concise yet meaningful way.

For instance, regular expressions could return all words with 'hop' within them. The following words would be identified using such an expression:

  • hop
  • hopeful
  • bellhop

Similarly, you might want just those which end in 'hop':

  • bellhop
  • shop

Regular expressions can also ensure that things like email addresses and telephone numbers are entered in the correct format.

Such is their power though that just about any pattern can be expressed. For instance, if you want to isolate a 8-11 character text string that can contain consonants and the digits 0-4, which begins with a dollar sign or caret character and ends with an underscore, this can be expressed quite concisely with a regular expression.

Want to get started with regular expressions? Check out our Regular Expression Resources Page.

Also Known As: regexp, regex
  1. About.com
  2. Technology
  3. Perl
  4. Perl Tutorials
  5. Perl Glossary
  6. Regular Expressions

©2014 About.com. All rights reserved.