| String.replace(…) test — $&, $`, $' and $nn |
| |
| On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". |
| |
| |
| PASS testString is "It's the end of the world as we know it, and I feel fine." |
| PASS testString.replace(/I feel/, 'yet $& just') is "It's the end of the world as we know it, and yet I feel just fine." |
| PASS testString.replace(/the end/, 'nice. $`a picture') is "It's nice. It's a picture of the world as we know it, and I feel fine." |
| PASS testString.replace(/feel fin/, "am gon$' By") is "It's the end of the world as we know it, and I am gone. Bye." |
| PASS testString.replace(/(t)(h)(e e)(n)(d)( o)(f)( )(t)(h)(e )([^r]*)(rld)/, 'not $12olly mammoth') is "It's not woolly mammoth as we know it, and I feel fine." |
| PASS successfullyParsed is true |
| |
| TEST COMPLETE |
| |