title: R tidyr regex: extract ordered numbers from character column
body: <p>Suppose I have a data frame like this</p>
  
  <pre><code>df &lt;- data.frame(x=c("This script outputs 10 visualizations.", 
                       "This script outputs 1 visualization.", 
                       "This script outputs 5 data files.", 
                       "This script outputs 1 data file.", 
                       "This script doesn't output any visualizations or data files", 
                       "This script outputs 9 visualizations and 28 data files.", 
                       "This script outputs 1 visualization and 1 data file."))
  </code></pre>
  
  <p>It looks like this</p>
  
  <pre><code>                                                            x
  1                      This script outputs 10 visualizations.
  2                        This script outputs 1 visualization.
  3                           This script outputs 5 data files.
  4                            This script outputs 1 data file.
  5 This script doesn't output any visualizations or data files
  6     This script outputs 9 visualizations and 28 data files.
  7        This script outputs 1 visualization and 1 data file.
  </code></pre>
  
  <p>Is there a simple way, possibly using the <code>Tidyverse</code> to extract the number of visualizations and the number of files for each row? When there are no visualizations (or no data files, or both) I would like to extract <code>0</code>. Essentially I would like the final result to be like this</p>
  
  <pre><code>    viz   files
  1    10       0
  2     1       0
  3     0       5
  4     0       1
  5     0       0
  6     9      28
  7     1       1
  </code></pre>
  
  <p>I tried using stuff like</p>
  
  <pre><code>str_extract(df$x, "(?&lt;=This script outputs )(.*)(?= visualizatio(n\\.$|ns\\.$))")
  </code></pre>
  
  <p>but I got so lost.</p>