blob: 20040064f61a8cd110bb705c51ebbfa2bf3c7011 [file] [log] [blame]
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 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(/end/, '$$ $0 $00 $1 $01 $2 $12 $9 $99 $1a $11a') is "It's the $ $0 $00 $1 $01 $2 $12 $9 $99 $1a $11a of the world as we know it, and I feel fine."
PASS testString.replace('end', '$$ $0 $00 $1 $01 $2 $12 $9 $99 $1a $11a') is "It's the $ $0 $00 $1 $01 $2 $12 $9 $99 $1a $11a of the world as we know it, and I feel fine."
PASS testString.replace(/(e)(n)(d) (o)(f) (t)(h)(e) (w)(o)(r)(l)(d)/, '$$ $0 $00 $1 $01 $2 $12 $9 $99 $1a $11a') is "It's the $ $0 $00 e e n l w w9 ea ra as we know it, and I feel fine."
PASS successfullyParsed is true
TEST COMPLETE