split html text in 2 paragraphs

Posted by Luca Romagnoli on Stack Overflow See other posts from Stack Overflow or by Luca Romagnoli
Published on 2010-04-11T22:22:58Z Indexed on 2010/04/11 22:33 UTC
Read the original article Hit count: 264

Filed under:
|

hi i have a html text like this:

aaa dafjsld dslajfk òsal asfòljd <a href="ciao.com">aa aa</a> adsfsadfsadfs

i want to split it in 2 paragraphs. but i don't want to generate this situation:

<p>aaa dafjsld dslajfk òsal asfòljd <a href="ciao.com">aa</p><p> aa</a> adsfsadfsadfs</p>

how can i check if the split involves any tags and avoid it?

thanks

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about string