jashkenas--coffeescript/test/test_regexp_interpolation.c...

20 lines
351 B
CoffeeScript
Raw Normal View History

name: 'Bob'
ok not not '"Bob"'.match(/^"${name}"$/i)
ok '"Bobby"'.match(/^"${name}"$/i) is null
ok not not 'Bob'.match(/^$name$/)
ok 'Bobby'.match(/^$name/)
ok 'Bobby'.match(/${"${"${"$name"}"}"}/imgy)
ok '$a$b$c'.match(/\$A\$B\$C/i)
a: 1
b: 2
c: 3
ok '123'.match(/$a$b$c/i)
2010-03-08 21:55:06 -05:00
[a, b, c]: [1, 2, /\d+/]
ok (/$a$b$c$/i).toString() is '/12/\\d+/$/i'