sutho100
2/18/2019 - 12:18 AM

Regular expression targeting all content within a div tag

regular expression matches all content between div and span
<div class="ratings-bar">(.*?)<\/span>

<div class="rating-bar">
  <div class="inline-block ratings-imdb-rating" name= "ir" data-value="7.2">
    <span class="global-spirite rating-star imdb-rating"></span>
    
    
  regular expression matches 2-3 character long numbers
  <span class="runtime">(\d{2,3}) min<\/span>
  
  <span class="runtime">75 min</span>
  
  an example of options
  
  if placing round bracket at the start and finishing with a question mark the content becomes optional
  
  (<div class="inline-block ratings-metascore">
    <span class="metascore (favorable|mixed|unfavorable)">
    (.*?)\s*?<\/span>\s*?Metascore\s*?<\/div>\s*?<\/div>\n)?<p class="text-muted">(.*?)<\/p>
    
    
    <div class="inline-block ratings-metascore">
    <span class="metascore favorable">62 </span>
      Metascore
      </div>
      </div>
      <p class="text-muted">
      A man lerns something extraodinary about himself after a devastating accident.</p>