Regular - vim - matching string using a non-greedy

  1. Outline

    1. vim under regular non-greedy match
  2. background

    1. Jvm review related content
    2. Find information derived, not very friendly, so I want to format
  3. surroundings

    1. THE
      1. win10
    2. git-bash
      1. mintty-2.9.4

1. The original segment

  1. paragraph

    Non-default VM flags: -XX:-BytecodeVerificationLocal -XX:-BytecodeVerificationRemote -XX:CICompilerCount=4 -XX:InitialHeapSize=1073741824 -XX:+ManagementServer -XX:MaxHeapSize=17163091968 -XX:MaxNewSize=5721030656 -XX:MinHeapDeltaBytes=524288 -XX:NewSize=357564416 -XX:OldSize=716177408 -XX:TieredStopAtLevel=1 -XX:+UseCompressedClassPointers -XX:+UseCompressedOops -XX:+UseFastUnorderedTimeStamps -XX:-UseLargePagesIndividualAllocation -XX:+UseParallelGC
    

2. Requirements

  1. The output text format

    1. format requirement
      1. Non-default VM flags: Make the trip alone
      2. The rest of each line, the format -XX:-BytecodeVerificationLocal
  2. The final product

    Non-default VM flags: 
    -XX:-BytecodeVerificationLocal 
    ...
    
    

3. Ideas

  1. Use ex expression
    1. Use ex expression, do replace
    2. Replace certainly be related to the regular

4. Try

Pretreatment

  1. First Non-default VM flags: singled out
    1. The latter format, basically the same, and very easy to deal with

1 try

  1. Use the ex command

    : s/\(-.* \)/\1\r/g
    
  2. result

    1. Discover content matching, and I expected quite the same
      1. In addition to that last -XX format, all my matches on
      2. And I think this is not the same ah ....
  3. Think

    1. Vaguely recall, heard the argument before a greedy match
      1. Greed match
        1. Try to match up to a content
        2. In particular repetition, like nested scene, obvious
      2. Non-greedy match
        1. Try to match the contents of a few

Try 2: introducing a non-greedy match

  1. Use the ex command

    : s/\(-.\{-} \)/\1\r/g
    
  2. Non-greedy

    1. .{-}
      1. This is the corresponding * non-greedy match

      2. Match result

        -XX:-BytecodeVerificationLocal
        
      3. Ah, in line with expectations

  3. Finally, a small modification

    1. In the final text, with a space
      1. So that you can look at all the rows processed
  4. problem

    1. path
      1. trigger
        1. There are variables path
        2. Space path inner tube
      2. note
        1. Cutting that might cut down some incomplete path
        2. I can only manually check
          1. Too much food should still own it ...

Try 3: Another Way of Thinking

  1. Use the ex command

    :s/\( -[A-Za-z0-9:-]*\)/\1\r/g
    
  2. How to say

    1. Failed ideas

      1. This idea glance valid
      2. But in fact, I miss a lot
    2. the difference

      1. Recipe for success
        1. Focus is in accordance with the mode split,
        2. Ignoring the middle of the content, to reduce a lot of workload
      2. Failed ideas,
        1. We do not pay attention to patterns, actually concentrate on looking for content
        2. But ignoring the essence
    3. But this line of thinking, I think sometimes, it should still work ...

      1. If found, I will write down

3. Follow-up

  1. Match the content of the scene

  2. At the same time matching the content and mode of scene

    1. Can one step
      2, or should I say, we need to match the pattern, and then matches
  3. vim match, there are a lot of content, the follow-up destined to be used to talk about it

  4. grep, awk, sed the same scene, how to deal with

ps

  1. ref
    1. VIM regularization of non-greedy match
    1 match thinking
    2. vim syntax associated with
    1. I do not know how better use
    2. ZZ: VIM regularization of non-greedy match
    1. genuine original
    1. Because typesetting and Sina microblogging not afraid, so we have ref1

Guess you like

Origin www.cnblogs.com/xy14/p/12643141.html
Recommended