Html 如何匹配正则表达式中的否定词

Html 如何匹配正则表达式中的否定词,html,regex,perl,Html,Regex,Perl,无论好坏,我都需要使用正则表达式执行以下操作: 匹配开始和结束文本区域html标记之间的所有内容: Other HTML <textarea id = foo class = 'bar'> some text which can include brackets> like that <thi is an opening bracket > that was a closing one </textarea> Other HTML 到目前

无论好坏,我都需要使用正则表达式执行以下操作:

匹配开始和结束文本区域html标记之间的所有内容:

Other HTML 
<textarea id = foo class = 'bar'> 

some text which can include brackets> like that 

<thi is an opening bracket > that was a closing one 

</textarea>
Other HTML
到目前为止,我得到的正则表达式如下所示,只是它没有一直到结束文本区域

<textarea id = foo[^>]+>[^>]+>

我们使用的是专有系统,没有其他选择。提前感谢您的帮助。

以下是我能想到的最简单的模式:

]*>.*? 。与s选项一起使用,或者如果工具允许,在图案前面添加?s。如果没有,请更换。使用[\s\s]作为解决方法

这使用了一个非语法量词

标签的内容在第一个也是唯一一个组中捕获。

带有:

输出:

<textarea id = foo class = 'bar'> 

some text which can include brackets> like that 

<thi is an opening bracket > that was a closing one 

</textarea>

我不使用RegExp,而是使用一些简单的香草JavaScript。像这样:

函数getText{ var text1=document.getElementById'text1'。值; document.getElementById'output'.innerHTML=text1; } 这是一篇带有一些和一些的文本。 获取上面的文本,将其存储在变量text1中,然后在下面显示它。

id=foo是什么?这是必需的属性/val吗?请尝试?s]+>*?
<textarea id = foo class = 'bar'> 

some text which can include brackets> like that 

<thi is an opening bracket > that was a closing one 

</textarea>