title: How do I return NULL if no regex match found in a character vector element?
body: <p>I have a character vector which looks like(<code>dput</code> output):</p>
  
  <pre><code>c("           genotype[0]= rv props(rr,rv,vv)=  0.000  0.944  0.056    reads=     10 , variants=      7", 
  "           genotype[1]= na ", "           genotype[2]= rv props(rr,rv,vv)=  0.000  1.000  0.000    reads=     16 , variants=      8", 
  "           genotype[3]= rv props(rr,rv,vv)=  0.001  0.999  0.000    reads=     13 , variants=      5", 
  "           genotype[4]= vv props(rr,rv,vv)=  0.000  0.489  0.511    reads=     10 , variants=      8", 
  "           genotype[5]= vv props(rr,rv,vv)=  0.000  0.051  0.949    reads=     10 , variants=      9", 
  "           genotype[6]= rr props(rr,rv,vv)=  1.000  0.000  0.000    reads=     20 , variants=      0", 
  "           genotype[7]= rv props(rr,rv,vv)=  0.000  1.000  0.000    reads=     15 , variants=      7", 
  "           genotype[8]= rr props(rr,rv,vv)=  0.975  0.025  0.000    reads=      7 , variants=      0", 
  "           genotype[9]= vv props(rr,rv,vv)=  0.000  0.001  0.999    reads=     17 , variants=     16"
  )
  </code></pre>
  
  <p>I'd like to return the second value in the triplet of probabilities for each character vector, i.e. 0.944, 0.999 etc. However, I also want <code>NULL</code> or something else in the result to indicate that line starting with <code>genotype[1]</code> had no match.</p>
  
  <p>My code looks like this:</p>
  
  <pre><code>regmatches(genotype_strings, regexpr("[[:digit:]].[[:digit:]]+  [[:digit:]].[[:digit:]]+  [[:digit:]].[[:digit:]]+", genotype_strings))
  </code></pre>
  
  <p>Though the result has only 9 elements, while I'd like to have 10.</p>
  
  <p>Thanks in advance!</p>