5 msgldap_search results limited
7 msgRe: Regex to catch <p>s (weird result)
11 msg$_SESSION v. Cookies
13 msgHow to determine if file is writable and deletable
1 msgphp make fails with Sybase15
2 msgProblems with mod_vhost_alias and PHP require
6 msgAI file and mapping with PHP
13 msgthe Y2K38 BUG
4 msgIncorrect version shown in phpinfo() and phpver...
2 msgGD - JPEG to PNG with transparency and color
4 msgPHP Web Apps & OpenID
3 msgadding the results of mysql_query
1 msggetting iostat -x %b with php
4 msgHandling Incoming Email Attachments
2 msgDifference between imagegif/imagejpeg sending t...
4 msgstrange behavior, when converting float to int

Regex to catch <p>s
\ Ryan S (6 May 2008)
. \ Eric Butera (6 May 2008)
. \ Ryan S (6 May 2008)
. . \ Shawn McKenzie (6 May 2008)
. . \ vester_s (6 May 2008)
. . . \ Ryan S (7 May 2008)
. . . . \ smulyono (8 May 2008)
. \ Aschwin Wesselius (6 May 2008)
. . \ Aschwin Wesselius (6 May 2008)
. . . \ Aschwin Wesselius (6 May 2008)
. \ Aschwin Wesselius (7 May 2008)

3 msgusing explode
4 msgRecommended book on PHP/SOAP
1 msgRES: [PHP-DB] Shopping cart session handling
Subject:RE: Re: Re gex to catch <p>s
Group:Php-general
From:smulyono
Date:8 May 2008


 
If you mean <p class='something'></p> then this should be okay:

$tag_regex=array(
'/\<p\>(.*?)\<\/p\> /si' => "$1",
'/\<p(\s*)class\=(*.?)\>(.*?)\<\/p\>/si' => "$2"
);
$paragraphs=preg_replace(array_keys($tag_regex),array_values($tag_regex),$pa
ge);

$paragraphs will be the return value
$page is the text with all of the tags that you want to stripped

If you want, you can try the first value in the array first which detect the
<p></p>. I didn't test this, but this should be working since I also use
this kind of way to revert the phpbb code into HTML.

HTH,

Thanks,


-----Original Message-----
From: Ryan S [mailto:genphp]
Sent: Wednesday, May 07, 2008 10:52 AM
To: vester_s
Cc: php php
Subject: Re: [PHP] Re: Re[PHP] gex to catch <p>s




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),$pa
ge);

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



© 2004-2008 readlist.com