Jump to content

Everything between the <div> tags?


MySQL_Narb

Recommended Posts


<div id="playerskills" align="center">
Personal scores for <br /><br />
<table>
<tr>
<td>Skill</td>
<td>Rank</td>
<td>Level</td>
<td>XP</td>
</tr>

<tr>
<td>Not Ranked</td>
<td>-</td>
<td>-</td>
</tr>

<tr>
<td>Not Ranked</td>
<td>-</td>
<td>-</td>
</tr>

<tr>
<td>Not Ranked</td>
<td>-</td>
<td>-</td>
</tr>

<tr>
<td>Not Ranked</td>
<td>-</td>
<td>-</td>
</tr>

<tr>
<td>Not Ranked</td>
<td>-</td>
<td>-</td>
</tr>

<tr>
<td>Not Ranked</td>
<td>-</td>
<td>-</td>
</tr>

<tr>
<td>Not Ranked</td>
<td>-</td>
<td>-</td>
</tr>

<tr>
<td>Not Ranked</td>
<td>-</td>
<td>-</td>
</tr>

<tr>
<td>Not Ranked</td>
<td>-</td>
<td>-</td>
</tr>

<tr>
<td>Not Ranked</td>
<td>-</td>
<td>-</td>
</tr>

<tr>
<td>Not Ranked</td>
<td>-</td>
<td>-</td>
</tr>

<tr>
<td>Not Ranked</td>
<td>-</td>
<td>-</td>
</tr>

<tr>
<td>Not Ranked</td>
<td>-</td>
<td>-</td>
</tr>

<tr>
<td>Not Ranked</td>
<td>-</td>
<td>-</td>
</tr>

<tr>
<td>Not Ranked</td>
<td>-</td>
<td>-</td>
</tr>

<tr>
<td>Not Ranked</td>
<td>-</td>
<td>-</td>
</tr>

<tr>
<td>Not Ranked</td>
<td>-</td>
<td>-</td>
</tr>

<tr>
<td>Not Ranked</td>
<td>-</td>
<td>-</td>
</tr>

<tr>
<td>Not Ranked</td>
<td>-</td>
<td>-</td>
</tr>

<tr>
<td>Not Ranked</td>
<td>-</td>
<td>-</td>
</tr>

<tr>
<td>Not Ranked</td>
<td>-</td>
<td>-</td>
</tr>

<tr>
<td>Not Ranked</td>
<td>-</td>
<td>-</td>
</tr>

<tr>
<td>Not Ranked</td>
<td>-</td>
<td>-</td>
</tr>

<tr>
<td>Not Ranked</td>
<td>-</td>
<td>-</td>
</tr>

<tr>
<td>Not Ranked</td>
<td>-</td>
<td>-</td>
</tr>

<tr>
<td>Not Ranked</td>
<td>-</td>
<td>-</td>
</tr>

</table>
</div>

 

Do you guys have any idea as to why the following REGEX does not pickup the above code?

 

~<div id="playerskills" align="center">((.|\n)+?)</div>~m

 

It works fine when the content between the divs is on one single line; however, with the HTML I provided, it tends to break due to the multiple lines. Any ideas? Thanks.

 

Using http://gskinner.com/RegExr/ to test.

Link to comment
https://forums.phpfreaks.com/topic/273809-everything-between-the-tags/
Share on other sites

The newlines in the source might be \r\ns.

~<div id="playerskills" align="center">(.+?)</div>~s

(/s is the one where dot-all matches newlines, /m is the one where ^ and $ can match the beginning and end of lines)

 

But like I said in your other thread, DOMDocument is much better for this than a regex.

The newlines in the source might be \r\ns.

~<div id="playerskills" align="center">(.+?)</div>~s

(/s is the one where dot-all matches newlines, /m is the one where ^ and $ can match the beginning and end of lines)

 

But like I said in your other thread, DOMDocument is much better for this than a regex.

 

Thank you. I was personally avoiding DOMDocument until I could spend some time to familiarize myself with it; however, I'll be sure to check it out once I finish my current project.

 

I appreciate the help. :)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.