cetinakat cetinakat - 27 days ago 4
PHP Question

How to get strings with Regex

I want to get strings between td's but one of the td has not close tag. How can I get from this tag with other string.

<td class="exclass">Text 0
<td class="exclass"><a href="exampleUrl">Text 1</a></td>
<td class="exclass"><a href="exampleUrl">Text 2</a></td>
<td class="exclass3" >Text</td >
<td class="exclass"> Text </td>
<td class="exclass3">Text</td>
<td class="exclass">Text</td>
<td class="exclass">Text</td><td class="exclass">Text</td>
<td class="exclass2">Text</td>
<td class="exclass">Text</td>
<td class="exclass" width="20"><a href="exampleUrl" rel="nofollow"><img src="exampleSrc"></a></td>

As you can see below code, I want to get Text 0 and the other strings with PHP.
So far, I tried to:



I assume because one of the td doesn't have close tag, that's why you can't use the DOM parser.

Here is my regex solution