NYCPHP Meetup

NYPHP.org

[nycphp-talk] PHP Regexp Classic Challenge

Peter Sawczynec ps at blu-studio.com
Fri Nov 19 06:45:02 EST 2010


I need to be able to grab the first 10 words or so from a HTML laden text
string that is held in a db table field where the typical field content
might be as follows below. After the processing, being left with only the
straight text with punctuation would be fine

 

<p><img src="/files/Screen%20img.png" alt="Fresh food makes for a great
snack." width="180" height="272" style="float: right;" /> </p> 

<p>Target bodu content begins here <em>and</em> may have any html tags
interspersed. Plus, users can users can use parens (anywhere) too.</p>

<br />------<br />

<p>Another paragraph</p>

 

I'm checking to see if over the years a best practice technique with regexp
or php funcs has been established to readily sove this classic display
challenge. 

 

Thanks for any <input />. 

 

Warmest regards, 

 

Peter Sawczynec 

Technology Dir.

blūstudio 

941.893.0396

 <mailto:ps at sun-code.com> ps at blu-studio.com 

 <http://www.blu-studio.com> www.blu-studio.com 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20101119/501135ba/attachment.html>


More information about the talk mailing list