0

How can I get the values in bold from the next string?

<td>26/02/2015</td><td>09:00</td><td>26/02/2015</td><td>12:00</td><td>3</td><td>I1/121</td><td>10074 codification</td><td>103126 Codification, Cooperation and development - 11</td><td>**Walter** Shelter, Mary; **Johnson** Smith, Robert; **Dickinson** Queen, Patty</td><td>without group</td>

Taking into account the values I want to get may be more or less. For example, the values between < td > and < /td > can be:

Walter Shelter, Mary; Johnson Smith, Robert; Dickinson Queen, Patty; More Values, John; AndMore Values, Alfred;

Or

Less Values, John; AndLess Values, Alfred;

I'm trying with regex, preg_split, preg_match, implode, explode and can't figure it out. Thanks!

EDIT: This is what I'm trying.

$myMatches = array();


          if(preg_match_all("~\<td\>{9}(.+?)\<\/td\>~",$filtered,$mat)){
                foreach($mat[1] as $match){
                  $myMatches[] = htmlentities($match);
                  }

          }
        foreach ($myMatches as $m){

        echo $m;

        }
user3321425
  • 201
  • 1
  • 2
  • 17
  • you can also use regex and find everything between 2 html tags – floor Mar 13 '15 at 14:00
  • why aren't you using javascript (jQuery) to find these specific elements? – Fadey Mar 13 '15 at 14:08
  • @Fadey , Ghost and floor, Thanks a lot for your response! Is javascript or regex necessary? I've been struggling with regex. – user3321425 Mar 13 '15 at 14:34
  • [Don't parse HTML with RegEx](https://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags/1732454#1732454), do a search for "PHP HTML parser". – Preston Badeer Mar 13 '15 at 15:23
  • if you use jQuery you wont have to use regex. that's what's jquery is all about, querying the DOM – Fadey Mar 13 '15 at 16:57

0 Answers0