2010-04-03 10:39:32 -04:00
|
|
|
# Regular expression literals.
|
2010-02-27 14:30:14 -05:00
|
|
|
ok 'x'.match(/x/g)
|
|
|
|
ok 'x'.match /x/g
|
|
|
|
ok 'x'.match(/x/)
|
|
|
|
ok 'x'.match /x/
|
|
|
|
|
|
|
|
ok 4 / 2 / 1 is 2
|
|
|
|
|
2010-07-25 01:23:37 -04:00
|
|
|
y = 4
|
|
|
|
x = 2
|
|
|
|
g = 1
|
2010-02-27 14:30:14 -05:00
|
|
|
|
2010-03-08 22:25:06 -05:00
|
|
|
ok y / x/g is 2
|
|
|
|
|
2010-05-14 09:14:41 -04:00
|
|
|
ok 'http://google.com'.match(/:\/\/goog/)
|
|
|
|
|
2010-07-25 01:23:37 -04:00
|
|
|
obj = {
|
2010-05-14 09:14:41 -04:00
|
|
|
width: -> 10
|
|
|
|
height: -> 20
|
|
|
|
}
|
2010-07-25 01:23:37 -04:00
|
|
|
id = 2
|
2010-05-14 09:14:41 -04:00
|
|
|
|
2010-08-12 20:24:53 -04:00
|
|
|
ok ' '.match(/ /)[0] is ' '
|
|
|
|
|
|
|
|
regexp = / /
|
|
|
|
ok ' '.match regexp
|
|
|
|
|
2010-05-14 09:14:41 -04:00
|
|
|
ok (obj.width()/id - obj.height()/id) is -5
|