Skip to content

Commit a120f70

Browse files
committed
fix regex examples
1 parent fc2d4d0 commit a120f70

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

_posts/2016-01-07-test-examples.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,20 @@ it('should be {a: 42}', function () {
5757

5858
#### regex
5959

60+
```js
61+
it('should include the variable "count"', function () {
62+
var regex = new RegExp('count');
63+
var string = target.toString();
64+
expect(string.match(regex)).to.be.true;
65+
});
66+
```
67+
6068
```js
6169
it('should access the property "prop"', function () {
6270
var regex1 = /\.prop/; // dot notation
6371
var regex2 = /\[["']prop["']\]/; // bracket notation
6472
var string = target.toString();
65-
var result = !!string.match(regex1) && !!string.match(regex2);
73+
var result = !!string.match(regex1) || !!string.match(regex2);
6674
expect(result).to.be.true;
6775
});
6876
```

0 commit comments

Comments
 (0)