title: Text extract and adding to new column
body: <p>Hi I am trying to kill two bird with one stone. </p>
  
  <p>Firstly if col b is populated get it to new (no issue here) and secondly if col b is blank extract part of the string - everything after Task and before space and input to "new". </p>
  
  <pre><code>a &lt;- c("11-010 Bla", "TASK 21 MMM", "TASK 03-11-11 Hah")
  b &lt;- c("11-010","","")
  new &lt;- c("","","")
  
  df &lt;- data.frame(a,b,new)
  
  
  a                 b          new
  11-010 Bla        11-010    
  TASK 21 MMM
  TASK 03-11-11 Hah
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>a                 b          new
  11-010 Bla        11-010     11-010   
  TASK 21 MMM                  21       
  TASK 03-11-11 Hah            03-11-11
  </code></pre>
  
  <p>I tried to get the task number using below but I am unable to add space to it. The task number is always followed by space.</p>
  
  <pre><code>gsub("^[^_]*TASK|\\.[^.]*\\s$", "", df$a)
  sub(".*?TASK=(.*?)' '.*", "\\1", df$a)
  </code></pre>