We help IT Professionals succeed at work.
Get Started

How do I fix this preg match snippet

rlb1 asked
Last Modified: 2013-12-12
I attempted to use the solution in the previous post, and received two errors.

Warning: Unexpected character in input: ''' (ASCII=39) state=1 in /pulldata.php on line 4

Parse error: syntax error, unexpected T_STRING in /pulldata.php on line 4

What I am attempting to do is capture the description between two <div> tags     >(.*)<

<div style="float:left; clear:both;">
                        The SonicWave DVI interconnect is designed for a state-of-the-art, no-compromise high-definition digital video connection. With SonicWave, you will experience absolute fidelity to the original video signal. Advanced cable design, top quality materials, and superior construction ensure a faultless digital experience and leave nothing to chance. Silver-plated oxygen-free copper conductors and nitrogen-foamed PE dielectric make this interconnect the right choice for the most demanding home cinema installations. 24K gold-plated connectors ensure superior signal transfer and a lifetime of precise, dependable performance. Two 80%+ OFC braids and 100% overlapped Mylar&reg; foil combine for full shielding against EMI/RFI interference. Don't compromise your high-definition signal; use the right interconnect! Each SonicWave DVI cable conforms completely to DVI-D specifications and DVI-D Dual Link bandwidth performance parameters. Tested to pass 1080p and CL2-rated for in-wall applications.<br/><br/><b>Connector 1:</b> DVI Male<br/><b>Connector 2:</b> DVI Male

Thanks for your help!!
//Original Code that returned the error

$strtest = '<a title="some title here" href="some url here">';
preg_match('%<a title=[\"]some title here[\"] href=([^`]*?)[\"]>%',$strtest,$extA);
'You should get the result: some url here.
echo $extA[1];

Open in new window

Watch Question
Most Valuable Expert 2011
Top Expert 2015
This problem has been solved!
Unlock 3 Answers and 5 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE