Solved look at the bottom to see.
i read my own website (yea its really mine) with file_get_contents to display a specific text later.
I display data of interviews on my site and i want to read the interview headline and the time to use it on another site (later it links to the other site).
The relevant code block is a table.
I use this format for every interview. Thats why i want to read it with preg_match_all.
Code:
<td>
Interview 1
<small style="color:gray">
Persons 2
Cameras 2
</small>
</td>
<td>
1018 min
</td>
As you can see, "Interview 1" is the head and the time is "1018".
Interview 1, Persons 2, Cameras 2 and the time are different every time.
I tried it by my own but somehow the pattern go crazy and match only a few or nothing.
Code:
preg_match_all('/<td>\s*(.+?)\s*<small style="color:gray">\s*<\/small>\s*<\/td><td>\s*(.+?)\s*<\/td>/is', $mysite, $match)
As you can see, i used \s* for the line breaks and spaces and (.+?) to match.
What's wrong with my search pattern? Or any tips how i can do it smarter?
Solved
I used

to solve it.
Problem1: Overcommit white spaces
Code:
<small style="color:gray">\s*<\/small>
There isn't just white space between this.
Problem2:
<\/td><td>
There was a new line between tds.
Fully pattern is:
Code:
'/<td>\s*(.+?)\s*<small style="color:gray">.+?<\/small>\s*<\/td>\s<td>\s*(.+?)\s*<\/td>/is'