Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/212.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Regex 需要帮助正则表达式删除第一个br标记吗_Regex - Fatal编程技术网

Regex 需要帮助正则表达式删除第一个br标记吗

Regex 需要帮助正则表达式删除第一个br标记吗,regex,Regex,我想转换这个字符串 <br> <br class="MsoNormal" align="justify" style="MARGIN: 0cm 0cm 0pt"> <br class="MsoNormal" align="justify" style="MARGIN: 0cm 0cm 0pt"> <br> <br> <br class="MsoNormal" align="justify" style="MARGIN: 0cm 0

我想转换这个字符串

<br>
<br class="MsoNormal" align="justify" style="MARGIN: 0cm 0cm 0pt">
<br class="MsoNormal" align="justify" style="MARGIN: 0cm 0cm 0pt">
<br>
<br>
<br class="MsoNormal" align="justify" style="MARGIN: 0cm 0cm 0pt">
Content here

如何使用regex?

要匹配标记,可以使用
]+>
,然后可以根据所使用的语言为每个匹配的标记使用替换方法

编辑:

使用php时:

$nohtml = preg_replace("/<[^>]+>/", "", $html);
$nohtml=preg_replace(“/]+>/”,“,$html);

其中
$html
是一个字符串,其中包含您希望不使用html的代码。

您的问题格式不正确。你会用哪种编程语言来做这件事?示例中的文本与您帖子标题中的问题陈述不一致。请详细说明并重新表述。@shesek和Bohemian绝对是的,但我不认为剥离标记就是解析。我们仍然想知道使用什么语言等。
perl-0777-pe的%%g'
$nohtml = preg_replace("/<[^>]+>/", "", $html);