Home  >  Q&A  >  body text

linux - find string in vim

Use vim to view a document, which contains the following strings:

complete[13]
complete[4]
complete[1]                                                              
complete[3]
abc[13]
13
4
1
3

How to find the first string that is not complete[13] and complete[3]?

过去多啦不再A梦过去多啦不再A梦2588 days ago1317

reply all(3)I'll reply

  • 高洛峰

    高洛峰2017-06-26 10:51:52

    Available for personal testing

    /^\(.*complete\[\(3\|13\)\]\)\@!.*

    Please refer to: Detailed explanation of @

    reply
    0
  • 大家讲道理

    大家讲道理2017-06-26 10:51:52

    If the string you are looking for is on a separate line and at the beginning of the line, as in the example, use
    ^(complete[(13|3)])@!
    If you want to find a line that is not complete[ 13] or 3
    sw(complete[(13|3)])@!

    reply
    0
  • 高洛峰

    高洛峰2017-06-26 10:51:52

    /complete[13] and /complete[3] /string are searching for a certain string. But searching for the first one is not. I don’t know. I didn’t see the question clearly.

    reply
    0
  • Cancelreply