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