如何在Jquery中设置模式正则表达式中的变量值。我想动态设置模式值。请帮我如何设置
<!DOCTYPE html>
<html>
<body>
<script language="javascript">
function checkABC(str){
var test="abc";
var pattern = /'test'/gi
if(str.match(pattern)){
alert('matches');
}else{
alert('no match');
}
}
</script>
<input type="button" value="matches" onclick="checkABC('deabcfg')" />
</body>
</html>