Welcome Guest, Not a member yet? Register   Sign In
Reg Exp (not strict CI)
#5

[eluser]abmcr[/eluser]
TheFuzzy0ne: this script replace a placeholder in a text with a set of image

[quote author="pistolPete" date="1241373944"]You could try the following:
Code:
$text = '<p><img title="prova " src="/CmsAB1/images/rullino.png" alt="5" /> <br />Il presidente del Consiglio critica .....<img title="ert" src="/CmsAB1/uploads/images/Image/.thumb_PICT0119.jpg" alt="ter" width="96" height="96" />.....</p>';
$pattern = '&<img.*src\=\".*\/images\/rullino.png\".*alt=\"(.+)\".*>&isU;';
preg_match_all($pattern, $text, $subpattern);

foreach ($subpattern[1] as $match)
{
    echo $match.'<br />';
}
[/quote]
Thank you: this work fine.
And i take advantage for another similar question:
for get the entire img tag and not only the tag what i do? the pattern
Code:
$pattern = '&<img.*src\=\".*\/images\/rullino.png\".*alt=\"(.+)\".*>&isU;';
extract the alt tag, but i need also the entire tag , i.e:
Code:
<img title="prova " src="/CmsAB1/images/rullino.png" alt="5" />
Thank you in advance.


Messages In This Thread
Reg Exp (not strict CI) - by El Forum - 05-03-2009, 03:12 AM
Reg Exp (not strict CI) - by El Forum - 05-03-2009, 06:51 AM
Reg Exp (not strict CI) - by El Forum - 05-03-2009, 07:05 AM
Reg Exp (not strict CI) - by El Forum - 05-03-2009, 07:16 AM
Reg Exp (not strict CI) - by El Forum - 05-03-2009, 10:21 AM
Reg Exp (not strict CI) - by El Forum - 05-03-2009, 11:23 AM
Reg Exp (not strict CI) - by El Forum - 05-04-2009, 02:12 AM
Reg Exp (not strict CI) - by El Forum - 05-04-2009, 07:02 AM
Reg Exp (not strict CI) - by El Forum - 05-04-2009, 08:43 AM



Theme © iAndrew 2016 - Forum software by © MyBB