Javascript匹配代码之间的文本

时间:2015-06-05 23:59:19

标签: javascript preg-match between

我想在javascript中使用preg_match从html主体获取确切的脚本函数;

我尝试但不工作:

var whatineed=jQuery('html').html().match('$j('#send_form').submit(function(e) {(.*?)return true;');alert(whatineed);

请帮忙,我需要准确地说明这一部分:

$j.cookie('77fd78cdfc6b67274cf648bdf9f2d0b7', '60c6083d29b6a29d11068fecee75ab99', {path: '/'});

使用javascript:

来自此类型的实体
<html><body><script language="JavaScript">
$j('#send_form').submit(function(e) {
    $j.cookie('77fd78cdfc6b67274cf648bdf9f2d0b7', '60c6083d29b6a29d11068fecee75ab99', {path: '/'});
    return true;
});
</script></body></html>

1 个答案:

答案 0 :(得分:0)

这正是您正在运行的JavaScript吗?您的引号有问题......

var whatineed=jQuery('html').html().match('$j(\'#send_form\').submit(function(e) {(.*?)return true;');alert(whatineed);