[英]RegEx with notepad++: Remove two groups of text
i have this string on a line:我在一行上有这个字符串:
('some text', 'some text', 'some text', '{\\n {\\n {\\n . <p>Some text<br>Some text<br>Some text<br></p> \\n} \\n} \\n}', 'some text' , 'some text')
and i would to have this result using RegEx with notepad++:我想使用带有记事本++的正则表达式得到这个结果:
('some text', 'some text', 'some text', '<p>Some text<br>Some text<br>Some text<br></p>', 'some text' , 'some text')
Is it possible?是否可以? Someone can help me?
有人可以帮助我吗? Thank you
谢谢
Yes, you can simply use the OR(|) operator between the two groups you want to remove, and cancel out the backslashes with a backslash是的,您可以简单地在要删除的两个组之间使用 OR(|) 运算符,并用反斜杠取消反斜杠
({\\n {\\n {\\n .)|( \\n} \\n} \\n})
in the replace tab, and select the regular expressions search mode在替换选项卡中,选择正则表达式搜索模式
{.+?(?=<)|(?<=>)[^<>]+}
{.+?(?=<)|(?<=>)[^<>]+}
LEAVE EMPTY
LEAVE EMPTY
. matches newline
. matches newline
. matches newline
Explanation:解释:
{ # opening brace
.+? # 1 or more any character but newline
(?=<) # positive lookahead, make sure we have < after
| # OR
(?<=>) # positive lookbehind, make sure we have > before
[^<>]+ # 1 or more any character that is not < or >
} # closing brace
Screenshot (before):截图(之前):
Screenshot (after):截图(后):
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.