title: regex for pattern between comma and period
body: <p>After hours of googling and fruitless attempts, I'm hoping someone can help with this admittedly easy question (although regexps are fairly unfamiliar to me evidently).</p>
  
  <p>I have the following type of data:</p>
  
  <pre><code>name &lt;- c("Doe, Mr. John")
  </code></pre>
  
  <p>and I want "Mr" from this, but the actual title varies. My main question is how I write regular expression in order to capture just the "Mr" part, without anything else?</p>
  
  <p>My current approach is as follows:</p>
  
  <pre><code>library(stringr)
  str_split(name, "[,\\s.]")[[1]][[3]]
  </code></pre>
  
  <p>and the best I managed to do using extraction was this:</p>
  
  <pre><code>str_extract(name, ", .*\\.")
  </code></pre>
  
  <p>I'm sure there's a simpler way, can anyone help me?</p>