Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/16.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
Php 正则表达式匹配关闭打开标记的文本换行_Php_Regex - Fatal编程技术网

Php 正则表达式匹配关闭打开标记的文本换行

Php 正则表达式匹配关闭打开标记的文本换行,php,regex,Php,Regex,跟随字符串必须匹配 das is<C strike ><c1>t ein text </c1></C><C u ><c1>der </c1></C><C b u ><c1>hier </c1></C>im <C i u ><c1>editor </c1></C><u></u>steh

跟随字符串必须匹配

das is<C strike ><c1>t ein text </c1></C><C u ><c1>der </c1></C><C b u ><c1>hier </c1></C>im <C i u ><c1>editor </c1></C><u></u>steht
但我变成了这样:

match[0] ------> das is
match[1] ------> t ein text 
match[2] ------> der 
match[3] ------> hier 
match[4] ------> im 
match[5] ------> editor 
match[6] ------> steht

我在另一个例子中提出了这个正则表达式,我想这非常适合你的情况:

(?:(?![^<>]*(?:>))[^<])+
或另一个正则表达式:

(?:(?![^<>]*(?:>))[^<](?![^<>]*</))+

对不起,我无法想象有人会理解你想要达到的目标。请让同事用适当的英语造句,这样我们就可以了解你在说什么。顺便说一句,你可能想要一些学习英语的书,因为即使是一个德国程序员也应该能够掌握英语的基本知识;-Nur ein kleiner提示:您的正则表达式匹配标记之间的所有文本,但我只需要不从标记中换行的文本,特别是在本例中是以下字符串匹配[0]-->das is match[1]-->im match[2]-->stehtyes它是正确的。。。有了这个正则表达式,我可以更好地包装匹配的字符串@jerry,可以给你写一封电子邮件,因为我有一个敏感的源代码,没有5行-我不想发布源代码。。。主题是:regex@jerry no,一切正常:但我有一个源代码。。。我只希望你重新检查代码。少于5行我不在网上发布@尼科,我想你可以给我发封电子邮件。我想这应该可以在我的StackOverflow配置文件中看到。
(?:(?![^<>]*(?:>))[^<])+
([^<>]+)(<[^>]+>(?:[^<>]*|(?2))</[^>]+>)*
(?:(?![^<>]*(?:>))[^<](?![^<>]*</))+