[nycphp-talk] Regex for P Elements
Randal Rust
randalrust at gmail.com
Wed Jan 12 08:24:45 EST 2011
I am admittedly not very good with regular expressions. I am trying to
pull all of the paragraphs out of an article, so that I can create
inline links. Here is my script:
$blockpattern='/<p*[^>]*>.*?<\/p>/';
$blocks=preg_match_all($blockpattern, $txt, $blockmatches);
This returns 0.
However, if I try to match H2 or EM, I get results.
$blockpattern='/<h2*[^>]*>.*?<\/h2>/';
$blockpattern='/<em*[^>]*>.*?<\/em>/';
What am I missing here?
--
Randal Rust
R.Squared Communications
www.r2communications.com
www.facebook.com/r2communications
614-370-0036
More information about the talk
mailing list