• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 20. The RegExp Object: Working w... > Regular Expression Objects

Regular Expression Objects

The regular expressions we’ve been using are actually treated as regular expression objects in JavaScript. There are two ways to create such objects—by just assigning a pattern to a variable (as we’ve been doing), or by explicitly creating a new regular expression object with the new operator:

var regexp = /pattern/[modifiers] 
var regexp = new RegExp("pattern",["modifiers"]) 


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint