title: Using str_extract_all to extract publications from specific portal out of hundreds of portals in a string.
body: <p>Using a simple code to extract the links to my articles (one by one) </p>
  
  <pre><code>library(rvest) 
  url = ("http://www.time.mk/week/2016/22")
  frontpage = read_html(url) %&gt;%
  html_nodes(".other_articles") %&gt;%
  html_attr("href") %&gt;%
  paste0()
  print(frontpage)
  mark = "http://www dot time dot mk/"
  frontpagelinks = paste0(mark, frontpage)
  final = list()
  final = read_html(frontpagelinks[1]) %&gt;%
  html_nodes("h1 a") %&gt;%
  html_attr("href")%&gt;%
  paste0()
  </code></pre>
  
  <p>I used 
      <code>a1onJune = str_extract_all(frontpage, ".*a1on.*")</code> to extract articles from the website a1on dot mk, which worked like a charm finding only the articles I needed. </p>
  
  <p>After getting some help here as to how to make my code more efficient, i.e. extract numerous links at once, via: </p>
  
  <pre><code>linksList &lt;- lapply(frontpagelinks, function(i) {
  read_html(frontapagelinks[i]) %&gt;%
  html_nodes("h1 a") %&gt;%
  html_attr("href")%&gt;%
  paste0()
  </code></pre>
  
  <p>which extracts all of the links I need, the same stringr code returns oddly enough something like this </p>
  
  <p>"\"standard dot mk/germancite-ermenskiot-genocid/\", \"//plusinfo dot mk/vest/72702/turcija-ne-go-prifakja-zborot-genocid\", <strong>\"/a1on dot mk/wordpress/archives/618719\",</strong> \"sitel dot mk/na-povidok-nov-sudir-megju-turcija-i-germanija\",</p>
  
  <p>Where as shown in bold I also extract the links to the website I need, but also a bunch of other noise that I definitely don't want there. I tried a variety of regex expressions, however I've not managed to define only those lines of code that contain a1on posts. </p>
  
  <p>Given that the list which I am attempting to clear out outputs separated links I am a bit baffled by the fact that when I use stringr it (as far as im concerned) randomly divides them into strings of multiple links: </p>
  
  <p>[93] "<a href="http://telegraf" rel="nofollow noreferrer">http://telegraf</a> dot mk /aktuelno/svet/ns-newsarticle-vo-znak-na-protest-turcija-go-povlece-svojot-ambasador-od-germanija.nspx"<br>
   [94] "<a href="http://tocka" rel="nofollow noreferrer">http://tocka</a> dot mk /1/197933/odnosite-pomegju-berlin-i-ankara-pred-totalen-kolaps-germanija-go-prizna-turskiot-genocid-nad-ermencite"<br>
   [95] "lokalno dot mk /merkel-vladata-na-germanija-e-podgotvena-da-pomogne-vo-dijalogot-megju-turcija-i-ermenija/"</p>
  
  <p>Any thoughts as to how I can go about this? Perhaps something that is more general, given that I need to do the same type of cleaning for five different portals.  </p>
  
  <p>Thank you. </p>