Created
July 5, 2015 12:38
-
-
Save yuanqing/a8b3453e58a578d7695d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var str = 'foobarbaz'; | |
var regexp = /bar/; | |
console.log(str.match(regexp)); //=> [ 'bar', index: 3, input: 'foobarbaz' ] | |
console.log(regexp.exec(str)); //=> [ 'bar', index: 3, input: 'foobarbaz' ] | |
console.log(regexp.test(str)); //=> true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment