Chapter 8. Forms and Regular Expressions
A regular expression (often abbreviated as RegExp) is a pattern, written using special symbols, which describes one or more text strings. You use regular expressions to match patterns of text, so that your script can easily recognize and manipulate text. Like an arithmetic expression, you create a regular expression by using operators, in this case operators that work on text, rather than numbers. There are many regular expression operators, and we'll look at some of the most common in this chapter. By learning and using these operators, you'll be able to save yourself a huge amount of effort whenever you need to detect and manipulate text strings.
But the syntax isn't that hard, so long as you break the gibberish down into small, meaningful pieces (at which point it's no longer gibberish). In this chapter, we'll demystify regular expression syntax and discuss how to make your code tighter and more powerful using regular expressions.