const str = 'Submission Date (Expected)';
const regex = new RegExp("^" + str + "$")
console.log(regex.test(str));
Output: FALSE
I'm using this site for testing: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp/test
The goal is to compare string, EXACT MATCH. When I remove brackets from const str it returns TRUE but i need TRUE with brackets.
I tried this but it doesn't work
const str = 'Submission Date \(Expected\)';