Created
May 27, 2018 16:49
-
-
Save ahmehri/eed47cf9a1d67f23eeca318647db083f to your computer and use it in GitHub Desktop.
This file contains 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
const msg = 'test'; | |
const test1 = 'test1'; | |
const regex = /test/; | |
console.log(regex.test(msg)); | |
const regex1 = `/${msg}/`; | |
// console.log(regex1.test(msg)) // regex1.test is not a function | |
const regex3 = /`${msg}$`/ | |
regex3 | |
console.log(regex3.test(msg)) | |
const regex2 = RegExp(`${msg}$`); | |
regex2 | |
console.log(regex2.test(msg)); | |
console.log(regex2.test(test1)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment