Jump to content

[SOLVED] preg_match help


dtdetu

Recommended Posts

hello can anyone help me how to solve this problem i want to get the content of this string

 

<p><small>21 December 2008 4:08 PM, PST</small></p>

<p>No, she&#39;s not running nekkid through London&#39;s filthy streets. This time, <a href="/name/nm1561881/">Amy Winehouse</a> is scoring her weekly dose of train-wreckognition by stripping down for a Beach romp on the Caribbean island of St. Lucia.

And we&#39;ve got to say, that in her News of the World slide show frolic, she looks much better than we&#39;d expected. For anyone else, this could be a career crisis, but for Amy it looks like a relatively healthy step in the right direction.

Go figure!</p>

 

i want to get

 

No, she&#39;s not running nekkid through London&#39;s filthy streets. This time, <a href="/name/nm1561881/">Amy Winehouse</a> is scoring her weekly dose of train-wreckognition by stripping down for a Beach romp on the Caribbean island of St. Lucia.

And we&#39;ve got to say, that in her News of the World slide show frolic, she looks much better than we&#39;d expected. For anyone else, this could be a career crisis, but for Amy it looks like a relatively healthy step in the right direction.

Go figure!

 

part of the string i am using

 

 preg_match("~<p><small>[^<]*<small>\s*<p>(.*?)</p>~i", $go, $content);

 

but it doesnt work can anyone help please. thanks

 

Link to comment
Share on other sites

Probably not very good but try this:

 

$str = <<<html
<p><small>21 December 2008 4:08 PM, PST</small></p>

<p>No, she's not running nekkid through London's filthy streets. This time, <a href="/name/nm1561881/">Amy Winehouse</a> is scoring her weekly dose of train-wreckognition by stripping down for a Beach romp on the Caribbean island of St. Lucia.

And we've got to say, that in her News of the World slide show frolic, she looks much better than we'd expected. For anyone else, this could be a career crisis, but for Amy it looks like a relatively healthy step in the right direction.

Go figure!</p>
html;

preg_match("#<p>.*?</p>.*<p>(.*?)</p>#is", $str, $match);

echo $match[1];

Link to comment
Share on other sites

hey i used

 

  preg_match("%</small>\s*</p>\s*<p>(.*?)</p>%si", $go, $content);

 

then i get this error, is % has something

msnbcLinks {font-size:11px; font-family:Arial, Helvetica, sans-serif; color: #999; margin-top: 5px; background: transparent; text-align: center; width: 425px;} .msnbcLinks a {text-decoration:none !important; border-bottom: 1px dotted #999 !important; font-weight:normal !important; height: 13px;} .msnbcLinks a:link, .msnbcLinks a:visited {color: #5799db !important;} .msnbcLinks a:hover, .msnbcLinks a:active {color:#CC0000 !important;} Visit msnbc.com for Breaking News, World News, and News about the Economy Christmas came early for the Duggar family, in the form of Jordyn-Grace Makiya, born – via C-section – last Thursday. Now that the baby's home, and "sleeping very well," says her father, Jim Bob Duggar, the family of 20 (minus eldest and married son Josh) flashed their collective smiles

 

it is not i want to get:(

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.