Remove lines that is shorter than or equal 5 characters after the : using Notepad++

前端 未结 2 1622
滥情空心
滥情空心 2021-01-26 14:20

The question is like: Remove lines that is shorter than 5 characters before the @ using Notepad++

But it differs a bit...

I have like that:

abc

相关标签:
2条回答
  • 2021-01-26 14:54

    Open Notepad++ find and replace choose regex mode in the search and place ^((?!.+:\d{5,}).)*$ in search and keep replace with blank and press replaceAll

    ^((?!.+:\d{5,}).)*$

    0 讨论(0)
  • 2021-01-26 14:59

    Without knowing the language there is only so much help I can offer. I'll give you an example of how I would solve this problem in C#.

    Start by creating a string for your updated file (without the short lines)

    string content = "";

    Read a line in from your file. Then get a substring of the line you read in - the abc: portion and check the length.

    line = line.substring(indexof(":"), length - indexof(":"))
    if(line.length > 5)
    {
      content += line;
    }
    

    At the end, truncate your file and write content to it.

    0 讨论(0)
提交回复
热议问题