Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

How do fix this Regex statement (Followup Question)

Posted on 2015-01-18
2
96 Views
Last Modified: 2015-01-28
How do I fix the last section of this regex?  The first two work (Pro Audio & Audio Recording), the last section (Drum Machines/Samplers)  does not.


<span class="head2"><strong><a href="category/pro-audio/1"><span class="head2">Pro Audio</span></a> </strong></span><strong> <span class="head3">&gt;</span> <a href="category/pro-audio/audio-recording/1">Audio Recording</a>
												&gt; <a href="products/pro-audio/audio-recording/drum-machines-samplers/1">Drum Machines/Samplers</a> </span>

Open in new window



This part works...   Need to add this part:
&gt; <a href="products/pro-audio/audio-recording/drum-machines-samplers/1">Drum Machines/Samplers</a> </span>

preg_match('%<span class="head2"><strong><a href="category/.*?/1"><span class="head2">(.*?)</span></a>\s*</strong></span><strong>\s<span class="head3">&gt;</span>\s<a href="category/.*?/.*?/1">(.*?)</a>(?:\s+\&gt;\s<a href="products/.*?/.*?/.*?/1">(.*?)</a> </span>\s+\&gt;\s(.*?)\s+</span>\s+</strong>\s+</td>)?
                                          %si',$buffer4,$matches4);

$a=$matches4[1];
$b=$matches4[2];
$c=$matches4[3];

Open in new window


Prior related question: http:Q_28599127.html
0
Comment
Question by:lawrence_dev
2 Comments
 
LVL 84

Accepted Solution

by:
ozo earned 500 total points
ID: 40557036
$buffer4='<span class="head2"><strong><a href="category/pro-audio/1"><span class="head2">Pro Audio</span></a> </strong></span><strong> <span class="head3">&gt;</span> <a href="category/pro-audio/audio-recording/1">Audio Recording</a>
                                                                                                                                                                                                  &gt; <a href="products/pro-audio/audio-recording/drum-machines-samplers/1">Drum Machines/Samplers</a> </span>
                                  ';
preg_match('%<span class="head2"><strong><a href="category/.*?/1"><span class="head2">(.*?)</span></a>\s*</strong></span><strong>\s<span class="head3">&gt;</span>\s<a href="category/.*?/.*?/1">(.*?)</a>\s+\&gt;\s<a href="products/.*?/.*?/.*?/1">(.*?)</a>%si',$buffer4,$matches4);
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question