我有字符串:
<em>hhhhhhhhhhhhh gggggggggggg hhhhhhhhhhh</em> <strong>hhhhhhhhhh hhhhhhhhh hhhhhhhhh</strong> gggggggggg ggggggg hhhhhhhhhhh ggggggggggggggggggggggggg <em>ggggggg ggggggg <strong>gggggggg dddddddddd</strong></em>
现在我找不到:
var regex = /<em>(.*?)<\/strong><\/em>/g;
var spr = string.match(regexxx);
alert(spr.toString());
这将打印我的完整字符串。
<em>hhhhhhhhhhhhh gggggggggggg hhhhhhhhhhh</em> <strong>hhhhhhhhhh hhhhhhhhh hhhhhhhhh</strong> gggggggggg ggggggg hhhhhhhhhhh ggggggggggggggggggggggggg <em>ggggggg ggggggg <strong>gggggggg dddddddddd</strong></em>
当然这很好。但这不是我想要的!我要这个:
<em>ggggggg ggggggg <strong>gggggggg dddddddddd</strong></em>
正则表达式必须找到以下之间的所有内容:
<em>...</strong></em>
但如果介于
<em>..**</em>**.</strong></em> .
这是不正确的:
<em>testestest</em>test test</strong></em>
这很好:
<em>test<strong>test test</strong></em>
我用什么正则表达式来做到这一点?