Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/regex/18.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/4/webpack/2.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 升华文本3中的负正则表达式匹配用于删除不需要的代码_Regex_Sublimetext_Sublimetext3 - Fatal编程技术网

Regex 升华文本3中的负正则表达式匹配用于删除不需要的代码

Regex 升华文本3中的负正则表达式匹配用于删除不需要的代码,regex,sublimetext,sublimetext3,Regex,Sublimetext,Sublimetext3,和它类似的变体,但没有运气 (?!\{)Row_Business">(.*?)</tr>(?!\}) 这与两组中的所有内容匹配。第二组括号现在是非捕获组,该组后面的*?使其成为非贪婪组。同样,根据提供的重新填充示例,使用\1\2\n\t将返回: (<tr[^>]+Row_Business\">)(?:[\n\t]*.*[\n\t]*)*?(</tr>) 我不确定你想要什么。将(?s)。*().替换为\1会起作用吗?@overdriven不会,

和它类似的变体,但没有运气

(?!\{)Row_Business">(.*?)</tr>(?!\})
这与两组中的所有内容匹配。第二组括号现在是非捕获组,该组后面的
*?
使其成为非贪婪组。同样,根据提供的重新填充示例,使用
\1\2\n\t
将返回:

(<tr[^>]+Row_Business\">)(?:[\n\t]*.*[\n\t]*)*?(</tr>)


我不确定你想要什么。将
(?s)。*().
替换为
\1
会起作用吗?@overdriven不会,因为您的重新填充示例是多行的。参见编辑的answer@garyh通过在非捕获组中使用[\s\s],可以进一步简化该正则表达式。我还建议跳过第二个捕获组中的正斜杠:(]+行\业务\“>)(?:[\s\s]*?)()
^[^<]*(<tr[^>]+Row_Business\">)([^<]+)(</tr>)
(<tr[^>]+Row_Business\">)(?:[\n\t]*.*[\n\t]*)*?(</tr>)
<tr class="GridRow_Business"></tr>
<tr class="GridAltRow_Business"></tr>
<tr class="GridRow_Business"></tr>
<tr class="GridAltRow_Business"></tr>