title: Regex for variable length
body: <p>I am looking for a regex or another command/workaround to extract all pkA values from a very large list for hundred of chemicals. So far, I have managed to extract the desired pkA values from a subset of my list.</p>
  <p>I wonder however if it is also possible to extract the whole lines that contain the pkAs? I figured since they all have a rather comparable length, you could extract these with a regex but I don't know how to implement the length inside the regex in combinations with the specific lines containing the pkA values?
  The reason why I wonder this is because my regex does not include pkAs that start with a 0. Chemicals like this are uncommon but they do exist. By extracting the whole line, I would also catch the few entries that give a temperature value which my regex is not including.</p>
  <p>Down below is a (hopefully) minimal working example with an extract of my list.</p>
  <pre><code>library(stringr)
  list_pkas &lt;- structure(list(Chemical = c(&quot;MCPA&quot;, &quot;Aspirin&quot;), pka = c(&quot;3.2.13Dissociation Constants\r\npKa= 3.13\r\nCessna AJ, Grover R; J Agric Food Chem 26: 289-92(1978)\r\nHazardous Substances Data Bank (HSDB)&quot;, 
                                                                       &quot;3.2.14Dissociation Constants\r\nAcidic pKa\r\n3.47\r\nTested as SID 103164874 in AID 781325: https://pubchem.ncbi.nlm.nih.gov/bioassay/781325#sid=103164874\r\nComparison of the accuracy of experimental and predicted pKa values of basic and acidic compounds. Pharm Res. 2014; 31(4):1082-95. DOI:10.1007/s11095-013-1232-z. PMID:24249037\r\nChEMBL\r\nAcidic pKa\r\n3.5\r\nTested as SID 103164874 in AID 781326: https://pubchem.ncbi.nlm.nih.gov/bioassay/781326#sid=103164874\r\nComparison of the accuracy of experimental and predicted pKa values of basic and acidic compounds. Pharm Res. 2014; 31(4):1082-95. DOI:10.1007/s11095-013-1232-z. PMID:24249037\r\nChEMBL; DrugBank\r\npKa = 3.49 at 25 °C\r\nO'Neil, M.J. (ed.). The Merck Index - An Encyclopedia of Chemicals, Drugs, and Biologicals. Whitehouse Station, NJ: Merck and Co., Inc., 2006., p. 140\r\nHazardous Substances Data Bank (HSDB)&quot;
  )), row.names = c(NA, -2L), class = c(&quot;tbl_df&quot;, &quot;tbl&quot;, &quot;data.frame&quot;
  ))
  
  string &lt;- list_pkas$pka[2]
  string_sub &lt;- str_sub(string, 7)
  pkas &lt;- str_extract_all(string_sub, &quot;([1-9]\\.[0-9]{1,2})&quot;)
  </code></pre>
  <p>The expected output should be for MCPA:</p>
  <pre><code>3.13
  </code></pre>
  <p>or</p>
  <pre><code>pKa=3.13
  </code></pre>
  <p>For Aspirin:</p>
  <pre><code>3.47
  3.5
  pKa = 3.49 at 25 °C
  </code></pre>
  <p>Any help is much appreciated!</p>