7. Forms and Regular Expressions
In This Chapter
Validating an Email Address with Regular Expressions 173
Formatting and Sorting Strings 187
Formatting and Validating Strings 189
Replacing Elements using Regular Expressions 192
Regular expressions are an amazingly powerful way to validate and format text strings. Using regular expressions, you can write a line or two of JavaScript code that can accomplish tasks that otherwise would have taken several dozen lines.
A regular expression (often abbreviated as RegExp or called by its synonym grep) is a pattern, written using special symbols, which describes one or more text strings. You use regular expressions to match patterns ...
Get JavaScript: Visual QuickStart Guide, Eighth Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.