I am comparing String input Start with \\\ For example:
\\\OR-01
Script to match the string
var input = '\\\\\\OR-01'
var room = 'OR-01'
var regex = new RegExp('\\\\\\'+room, 'i');
var regexResult = regex.exec(input);
console.log(regexResult); --output is [ '\\OR-01', index: 2, input: '\\\\\\OR-01' ]
But if I change the input Which starts with \W, \B, \N my logic is not working.
var input = '\\\\\\WR-01'
var room = 'WR-01'
var regex = new RegExp('\\\\\\'+room, 'i');
var regexResult = regex.exec(input);
console.log(regexResult); ------output is null.
For \W, \B, \N may be other characters as well I am getting null. How to solve this problem?