Chapter 20. The RegExp Object: Working with Regular Expressions

The RegExp Object: Working with Regular Expressions

One of the powerful aspects of JavaScript is its capability to work with text. Ever since Internet Explorer 4.0 and Netscape Navigator 4.0, that has been augmented by being able to work with regular expressions. Regular expressions enable you to handle not only text strings as variables, but also work with the text content of those strings.

Using a regular expression, you can specify what kind of text substrings you want to match and work with. For example, here’s how I’m using the regular expression /[aeiou]/ to search text in a text field for vowels, and if any vowels are found, to ...

Get Inside JavaScript 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.