I'm trying to use the following pattern with RegExp, but it doesn't seem to work right. When I take the same expression and use it directly, the expression works correctly.
The expression is designed to find numbers or numbers with letter at the end.
The example below should not find any match in the string.
The RegExp example finds "ld". Why? What am I doing wrong?
var str = "printf(\"Hello World\");";
var myPattern = new RegExp("([^\w][\d]+[\w]*)|(^[\d]+[\w]*)");