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/5/tfs/3.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 记事本++;删除字符串长度小于10个字符的行_Regex_Replace_Find_Notepad++ - Fatal编程技术网

Regex 记事本++;删除字符串长度小于10个字符的行

Regex 记事本++;删除字符串长度小于10个字符的行,regex,replace,find,notepad++,Regex,Replace,Find,Notepad++,记事本++可以删除少于10个字符的行 ^.{0,9}$ 但是,如果我想删除字符串长度小于10个字符的行 示例: hello world, my name Peter. hello world, mynamePeter. 字符串“mynamePeter”超过10个字符,我需要删除行容器“mynamePeter”。如何操作?使用{10,}\r?\n处理任何长度为10个字符的行 或者如果单词有10个或更多字符:*\w{10}.*\r?\n使用{10,}\r?\n表示任何10个字符的行长 或者如果单

记事本++可以删除少于10个字符的行

^.{0,9}$
但是,如果我想删除字符串长度小于10个字符的行

示例:

hello world, my name Peter.
hello world, mynamePeter.

字符串“mynamePeter”超过10个字符,我需要删除行容器“mynamePeter”。如何操作?

使用
{10,}\r?\n
处理任何长度为10个字符的行


或者如果单词有10个或更多字符:
*\w{10}.*\r?\n

使用
{10,}\r?\n
表示任何10个字符的行长

或者如果单词有10个或更多:
*\w{10}.*\r?\n

  • Ctrl+H
  • 查找内容:
    ^.*?\b\w{10,}\b*?(?:\R\124;\ z)
  • 替换为:
    留空
  • 检查环绕
  • 检查正则表达式
  • 取消选中
    。匹配换行符
  • 全部替换
说明:

^                   # beginning of line
  .*?               # 0 or more any character but newline
  \b                # word boundary
  \w{10,}           # 10 or more word character
  \b                # word boundary
  .*?               # 0 or more any character but newline
  (?:\R|\z)         # non capture group, end of line or end of file
屏幕截图(之前):

^                   # beginning of line
  .*?               # 0 or more any character but newline
  \b                # word boundary
  \w{10,}           # 10 or more word character
  \b                # word boundary
  .*?               # 0 or more any character but newline
  (?:\R|\z)         # non capture group, end of line or end of file

屏幕截图(之后):

^                   # beginning of line
  .*?               # 0 or more any character but newline
  \b                # word boundary
  \w{10,}           # 10 or more word character
  \b                # word boundary
  .*?               # 0 or more any character but newline
  (?:\R|\z)         # non capture group, end of line or end of file

  • Ctrl+H
  • 查找内容:
    ^.*?\b\w{10,}\b*?(?:\R\124;\ z)
  • 替换为:
    留空
  • 检查环绕
  • 检查正则表达式
  • 取消选中
    。匹配换行符
  • 全部替换
说明:

^                   # beginning of line
  .*?               # 0 or more any character but newline
  \b                # word boundary
  \w{10,}           # 10 or more word character
  \b                # word boundary
  .*?               # 0 or more any character but newline
  (?:\R|\z)         # non capture group, end of line or end of file
屏幕截图(之前):

^                   # beginning of line
  .*?               # 0 or more any character but newline
  \b                # word boundary
  \w{10,}           # 10 or more word character
  \b                # word boundary
  .*?               # 0 or more any character but newline
  (?:\R|\z)         # non capture group, end of line or end of file

屏幕截图(之后):

^                   # beginning of line
  .*?               # 0 or more any character but newline
  \b                # word boundary
  \w{10,}           # 10 or more word character
  \b                # word boundary
  .*?               # 0 or more any character but newline
  (?:\R|\z)         # non capture group, end of line or end of file

不确定它是否有效,但您可以使用^.{10,}$来匹配包含10个以上字符的行。您的问题不清楚,我认为您将字符串和单词混为一谈。请输入,并添加预期结果。你想删除整行还是只删除长度大于(或等于?)10个字符的单词?我有一个更新问题要澄清。不确定它是否有效,但你可以使用^.{10,}$来匹配长度超过10个字符的行。你的问题不清楚,我认为你是在混淆字符串和单词。请输入,并添加预期结果。您想删除整行还是只删除长度大于(或等于?)10个字符的单词?我有一个更新问题要澄清。