Skip to content

Commit dc3beb4

Browse files
committed
Regex tests passing
1 parent f854b9d commit dc3beb4

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

topics/about_regular_expressions.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,28 @@ $(document).ready(function(){
66
test("exec", function() {
77
var numberFinder = /(\d).*(\d)/;
88
var results = numberFinder.exec("what if 6 turned out to be 9?");
9-
ok(results.equalTo([__, __, __]), 'what is the value of results?');
9+
ok(results.equalTo(["6 turned out to be 9", "6", "9"]), 'what is the value of results?');
1010
});
1111

1212
test("test", function() {
1313
var containsSelect = /select/.test(" select * from users ");
14-
equals(containsSelect, __, 'does the string provided contain "select"?');
14+
equals(containsSelect, true, 'does the string provided contain "select"?');
1515
});
1616

1717
test("match", function() {
1818
var matches = "what if 6 turned out to be 9?".match(/(\d)/g);
19-
ok(matches.equalTo([__, __]), 'what is the value of matches?');
19+
ok(matches.equalTo(["6", "9"]), 'what is the value of matches?');
2020
});
2121

2222
test("replace", function() {
2323
var pie = "apple pie".replace("apple", "strawberry");
24-
equals(pie, __, 'what is the value of pie?');
24+
equals(pie, "strawberry pie", 'what is the value of pie?');
2525

2626
pie = "what if 6 turned out to be 9?".replace(/\d/g, function(number) { // the second parameter can be a string or a function
2727
var map = {'6': 'six','9': 'nine'};
2828
return map[number];
2929
});
30-
equals(pie, __, 'what is the value of pie?');
30+
equals(pie, "what if six turned out to be nine?", 'what is the value of pie?');
3131
});
3232

3333
// THE END

0 commit comments

Comments
 (0)