mirror of
https://github.com/espruino/Espruino.git
synced 2025-12-08 19:06:15 +00:00
11 lines
294 B
JavaScript
11 lines
294 B
JavaScript
// test for string match
|
|
// string match
|
|
var s = "Hello There".match("here");
|
|
// RegExp
|
|
var c = "Hello There".match(/There/);
|
|
var g = "Hello There".match(/[a-z]/g);
|
|
|
|
result = s[0] == 'here' && s.index = 7 &&
|
|
c[0] == 'There' && c.index = 6 &&
|
|
g.join(',') == 'e,l,l,o,h,e,r,e';
|