正则表达式:在包含另一个符号的符号之间选择文本/字符串(包含特定字符串的标签)

Jus*_* Me 4 notepad++ regex windows-10

我想选择所有文本之间=>=>仅当包含[]

我爱你=> predici-video [date] =>在我和她之间。

所以,只有这个 => predici-video [date] =>

har*_*ymc 7

搜索 : =>.*(\[|\]).*=>

解释:

  • .* - 零个或多个字符
  • (one|two) - 非此即彼
  • \[- 字符[逃脱。

记事本++截图:


在此处输入图片说明


Tot*_*oto 5

  • Ctrl+F
  • 找什么: (?<==>)[^=>]*[][][^=>]*(?==>)
  • 检查 环绕
  • 检查 正则表达式
  • Find All in Current Document

解释:

(?<==>)     # positive lookbehind, make sure we have => before
[^=>]*      # 0 or more any character that is not = or >
[][]        # character class, matches [ or ]
[^=>]*      # 0 or more any character that is not = or >
(?==>)      # positive lookahead, make sure we have => after
Run Code Online (Sandbox Code Playgroud)

如果您也想捕获=>,请使用:=>[^=>]*[][][^=>]*=>


截图(之前):

在此处输入图片说明

截图(后):

在此处输入图片说明