Regular Expression Object Properties
Whenever you create a regular expression, both the RegExp static object and the regular expression object instance you just created are given some properties. Let's take a look at them.
First, let's see what happens to these objects when you first create a regular expression, but haven't done anything with it yet. Say Example 17-1 holds all the code we have.
Example 17-1. Creating a regular expression object
ordString = "How many boards would the Mongols hoard, if the Mongol hordes were bored?" re = /\bmongol\b/ig |
First, let's look in Table 17-4 for all the properties the re object now has.
PROPERTY | VALUE |
---|---|
re.source | "\bmongol\b" |
re.global | True |
re.ignoreCase | True |
Get Advanced JavaScript™: Insights and Innovative Techniques 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.