Re: Re: Re[PHP] gex to catch <p>s

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




 
Hey,

<clip>
$tag_regex=array(
  '/\<p(\s*)\>(.*?)\<\/p\> /si' => "$1",
  '/\<(\s*)(*.?)class\=(*.?)\>(.*?)\<\/(*.?)\>/si' => "$3"
);

$paragraphs=preg_replace(array_keys($tag_regex),array_values($tag_regex),$page);

I am not sure what tag is that you mean on <class="something">, but in this
RE .. it should capture any <p> tags (the first element of the array) and
any tags (the second element of the array) that has attribute class on it. 
 </clip>

Thanks for replying!
Sorry, a bit of a typo there, i meant <p class="something">

I ran your regex but got this warning:
Warning:  preg_replace() [function.preg-replace]: Compilation failed: nothing to repeat at offset 8 in C:\xampp2\htdocs\ezee\tests\para_regex.php on line 25


I think I ran it wrong, because although i have passed $page i dont know where to pass the replacement texts...

Can you give me an example on how to run this or an explanation?

Thanks!
R



      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux