title: VIM substitute in php_getset plugin
body: <p>I'm looking at a vim ftplugin named <a href="https://github.com/docteurklein/php-getter-setter.vim/blob/master/ftplugin/php_getset.vim" rel="nofollow">php_getset</a>. It generates getters and setters for php properties. While it works pretty well, it does not correctly guess the indentation. I'm am trying to fix this. The relevant code is as follows:</p>
  
  <pre><code>let s:phpname = '[a-zA-Z_$][a-zA-Z0-9_$]*'
  let s:variable = '\(\s*\)\(\([private,protected,public]\s\+\)*\)\$\(' . s:phpname . '\)\s*\(;\|=[^;]\+;\)'
  ... (inside a function)
  let s:indent    = substitute(a:variable, s:variable, '\1', '')
  let s:varname   = substitute(a:variable, s:variable, '\4', '')
  let s:funcname  = toupper(s:varname[0]) . strpart(s:varname, 1)
  </code></pre>
  
  <p>From debugging it, I see that <code>a:variable</code> has the value <code>d $downPayment;</code> (The d comes from the end of the word "protected"). I don't understand the the third argument to <code>substitute</code> accomplishes. I've read about backreferences before, but I can't see what they're doing in this code.</p>
  
  <p>Thanks in advance for any help. Let me know if I can make my question more clear or provide more detail.</p>