lawrence_dev
asked on
Where am I going wrong with this preg-match?
I am trying to pull all of the data between two <div> tags and I am getting the following error:
Notice: Undefined offset: 1.
What am I doing wrong?
Here is the description I am attempting to get:
Notice: Undefined offset: 1.
What am I doing wrong?
preg_match('%<div class="productdescription" itemprop="description">(.*?)<\/div>%i',$buffer,$matches16);
$LongDesc=$matches16[1];
echo $LongDesc."<BR>";
Here is the description I am attempting to get:
START HERE ----> <div class="productdescription" itemprop="description">
<p>
Built with assistance from bike patrol officers nationwide, the 5.11 Bike Patrol Polo was designed to provide bike mounted officers with a safe, reliable,
and thoroughly professional alternative to baggy or constricting police bike patrol shirts. Crafted from lightweight, breathable, high performance jersey
knit polyester, the 5.11 Bike Patrol Polo offers superior moisture wicking performance, quick drying action, and anti-microbial characteristics that keep
you looking and feeling your best all day long. Integrated reflective tape increases visibility, an underarm gusset ensures full freedom of movement, a
generous length and drop tail ensures your bike polo stays tucked in, and a mic loop at the placket keeps you connected. Best of all, the bright colors on
our bike patrol shirts are colorfast against perspiration and sunlight, ensuring a clean, professional appearance throughout your shift.
</p>
<ul>
<li>
Chest Pen Pocket
</li>
<li>
Underarm gusset for mobility
</li>
<li>
Integrated reflective tap
</li>
<li>
Moisture wicking, quick drying, anti-microbial
</li>
<li>
Mic loop at front placket
</li>
<li>
Colorfast to Light & Perspiration
</li>
<li>
Jersey knit polyester
</li>
<li>
Performance Fit
</li>
<li>
Generous Length
</li>
<li>
Drop tail
</li>
</ul>
</div> <--- END HERE
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ray, Way too technical and difficult to understand. The more simple it is, the easier it is to understand, and build on. If I could understand the examples on php.net, I would not need Experts-Exchange!