简体   繁体   English

Notepad++ 在两个竖线之间查找 50 个字符或更长的字符串

[英]Notepad++ Find strings 50 characters or longer between two vertical bars

I would like to ask for help with the regular expression to use in Notepad ++ that will find any text that is 50 or longer, and is between 2 vertical bars?我想就在记事本 ++ 中使用的正则表达式寻求帮助,它会找到 50 或更长的任何文本,并且在 2 个竖线之间?

Example:例子:

060801113494|I am writing a string that is longer that 50 characters|1054.70|2020-12-10 10:27:20|My Test|10511078

I saw some examples and have this version, but it is not working:我看到了一些示例并拥有此版本,但它不起作用:

 \|(?:(?!\|).){50,}

The string can contain special characters.字符串可以包含特殊字符。

Thank you, Erasmo谢谢你,伊拉斯莫

The pattern \|(?:(?.\|),){50,} matches the leading |模式\|(?:(?.\|),){50,}匹配前导| and does not make sure that there is a closing one.并且不确保有一个关闭的。

You can match a pipe, then forget what is matched so far and continue matching 50 or more chars other than a |您可以匹配 pipe,然后忘记到目前为止匹配的内容并继续匹配除|之外的 50 个或更多字符while asserting one at the end.最后断言一个。

\|\K[^|]{50,}(?=\|)

Explanation解释

  • \| Match a |匹配一个|
  • \K Forget what is matched so far \K忘记到目前为止匹配的内容
  • [^|]{50,} Match 50+ times any char except | [^|]{50,}匹配除|以外的任何字符 50 次以上
  • (?=\|) Positive lookahead, assert a | (?=\|)正向前瞻,断言 a | at the right在右边

Regex demo正则表达式演示

在此处输入图像描述

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在记事本中删除两个字符或字符串之间的空格 - How to remove a space between two characters or strings in notepad++ 使用正则表达式和记事本++删除两个竖线之间的日语文本 - Removing Japanese text between two vertical bars using regex and notepad++ 查找所有其他字符串之前没有的字符串,并且在记事本++中可以找到介于两者之间的任何内容 - Find all strings not preceeded by another, with anything in between in notepad++ 如何使用Regex删除Notepad ++中两个字符串之间的文本? - How to use Regex to remove text between two strings in Notepad++? 如何删除记事本++中两个字符之间的文本 - How do I delete text between two characters in notepad++ 如何用记事本++替换两个字符之间的空格 - How to replace whitespace with notepad++ between two characters Notepad ++使用正则表达式搜索长度超过30个字符的字符串,并忽略句点(如果有) - Notepad++ use regex to search strings longer than 30 characters and ignore periods if any NotePad ++正则表达式之间找到 - NotePad++ regex find between Notepad ++如果其他字符串之间存在第三个字符串,则删除两个字符串之间的文本 - Notepad++ Removing text between two strings if third string is present between other strings 在Notepad ++中只保留引号之间的字符串 - Keep only the strings in between quotes in Notepad++
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM