This is the continuation of php regex: phone number 7-12 digits may contain hypen or space
I'm still trying to understand backreferences. The following is the JavaScript code I came up with to test backreferences. When I run this code only null
is being outputted. Where am I going wrong?
<script type="text/javascript">
function myRegexFunc()
{ myString="abcabcxabcdefghi";
patt1=new RegExp("(abc)?\1x\1");
document.write(patt1.exec(myString));
}
</script>
</head>
<body onload="myRegexFunc()">
</body>