正则表达式怎么表示匹配的字符串中不能包含某个字串?

问题描述:

<script A>...</script><script B>...</script><script ...>...</script>

如上字符串,
...表示:任意有数字字母组成的字符串。
怎么匹配出

<script B>...</script>

正则表达式怎么写?

var reg = /^(< script B>)< /script>$/
^符号可以匹配开头
$字符可以锁定结尾
或者试试
/^[ < script b>][\w]*[/< /script>]$/

\<script\s[^A]>\w+\<\/script\>