Another alternative syntax is
var pattern = new RegExp("<%= Resources.abcResources.patterntText %>");
It strongly types the variable as a RegExp. Your original code
var pattern= "<%= Resources.abcResources.patterntText %>";
was interpreted as a string rather than a RegExp. And using the RegExp constructor avoids the VS validation error caused by this code:
var pattern = <%= Resources.abcResources.patterntText %>