We have already seen the two ways of instantiating a Regular Expression object:
var re = /pattern/{flags}and
var re = new RegExp("pattern",{"flags"})Regular Expression objects store patterns used when searching strings for character combinations. After the Regular Expression object is created, it is either passed to a String method, or a string is passed to one of the Regular Expression methods.