title: Is there a decent Vim regexp OR command? What is the best way to find mismatched if else's?
body: <p>I have some mismatching if and fi statements in a script.  I would like to strip out everything but the if's else's and fi's.  Just so I can see the structure.  Why am working so HARD with such a powerful editor?  I need a <strong>BIGFATOR</strong> operator for regexp or some epiphany that has eluded me... I don't care for pontification on regular expressions just something practical working in VIM7.2.  </p>
  
  <blockquote>
    <p>:g/[ ^\t]if [/print</p>
  </blockquote>
  
  <p>will print out the ifs </p>
  
  <blockquote>
    <p>:g/[ ^\t]fi/print</p>
  </blockquote>
  
  <p>will printout the fi</p>
  
  <p>What I want to do is or the conditions</p>
  
  <p>:g/[ ^\t]fi <strong>BIGFATOROPERATOR</strong> [ ^\t]fi/print</p>
  
  <p>I have had success doing the following... but I feel I am working TOO HARD!</p>
  
  <blockquote>
    <p>:call TripMatch('[ ^\t]*if [', 'else', 'fi[ \t$]')</p>
    
    <p>function! TripMatch(str1, str2, str3)</p>
    
    <p>let var1 = a:str1</p>
    
    <p>let var2 = a:str2</p>
    
    <p>let var3 = a:str3</p>
    
    <p>let max = line("$")</p>
    
    <p>let n = 1</p>
    
    <p>for n in range (1, max)</p>
    
    <p>let currentline = getline(n)</p>
  
  <pre><code>if currentline =~? var1
  
     echo n "1:" currentline
  
  else
  
     if currentline =~? var2
  
        echo n "2:" currentline
  
     else
  
        if currentline =~? var3
  
           echo n "3:" currentline
  
        else
  
           let foo = "do nothing"
  
        endif
  
     endif
  
  endif     
  </code></pre>
    
    <p>endfor</p>
    
    <p>endfunction</p>
  </blockquote>