Examples of match (string) and exec (RegExp)
//Match one d followed by one or more b's followed by one d
//Remember matched b's and the following d
myRe=/d(b+)(d)/ig; str = "cdbBdbsbz";
myArray = myRe.exec( str );
myArray.index Index of First Character Matched i.e. 1
myArray.input The original String i.e. cdbBdbsbz
myArray[0] The characters matched i.e. dbBd
myArray[1] The first parenthesis i.e. bB
myArray[2] The second parenthesis i.e. d
The static properties of RegExp are set including $` $& $’ $1 $2 lastMatch lastParen
Properties source lastIndex multiline global ignoreCase of myRe are also set
Can also use myArray = str.match(myRe)