I'm currently attempting to find a pattern that includes the pipe (|) operator.
Here is the code I've used to match the pattern:
var format = /[ \\|]/; // This is the pattern for matching the pipe pattern
if ("Near raghavendra temple ring roads".match(format)) {
alert("Invalid character");
}
The string
"Near raghavendra temple ring roads"
does not actually contain the | operator, yet the condition above still evaluates to true.
I'm struggling to understand what mistake might be present in the pattern above.