如何連接javascript var xx
與/\
和\b/
?如何連接JavaScript var與文本?
https://jsfiddle.net/6r4o5278/6/
<div onclick="check()">CLICK HERE</div>
<script>
function check() {
var str = "abcdefg";
var xx = "abc";
if (/\+xx+\b/.test(str))
{
alert("found");
} else
{
alert("not found");
}
}
</script>
我必須使用'/ \ ABC \ B /' –