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.

Edited by MySQL_Narb
Link to comment
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.

Link to comment
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.

 

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. :)

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.