How do you correctly structure an "|" either/or REGEX statement

Experts,
I know the way I am doing this is a little elementary, but I am trying to learn...  (Please keep the response fairly simple. I do not quite understand the complex Regex yet...)

How do I correctly structure this REGEX statement.  I have the brackets "|" in place to make this be an either/or statement and my other similar statement works fine.

I am getting a weird error that I cannot figure out, so I am thinking it means something is wrong above the end line...

Parse error: syntax error, unexpected ',' in /home/public_html/feed.php on line 175

(I am making a product feed for my store to submit to Shopping.com, Google Base, etc.  All of my other REGEX statements work fine with   %statement_here%s',$buf1,$matches80);

Thanks for your help!!
preg_match('%<td align="right">Availability:<\/td>
                        <td  style="font-weight:bold;">
                            <font class="greensmbold"> (.*?) <\/font><font class="greensmbold">(.*?) <span class="blacksmbold">(.*?) <a class="blacksmbold" style="text-decoration:underline;" href="/shipping_tips.asp?" target="_blank" onclick="javascript:popup\('/shipping_tips.asp?'\); return false;">(.*?)<\/a><\/span><\/font>
                        <\/td>
                   <\/tr>|<td align="right">Availability:<\/td>
                        <td  style="font-weight:bold;">
                            <font class="blacksmbold">(.*?)<\/font>
                        <\/td>|<td align="right">Availability:<\/td>
                        <td  style="font-weight:bold;">
                            <font class="redsmbold">(.*?)<\/font><font class="blacksmbold">(.*?)<\/font>
                        <\/td>%s',$buf4,$matches85);
$a=$matches85[1];
$b=$matches85[2];
$c=$matches85[3];
$d=$matches85[4];



$stockmessage = $a . $b . $c . $d;

echo $stockmessage."<br />";

Open in new window

rlb1Asked:
Who is Participating?
 
käµfm³d 👽Connect With a Mentor Commented:
There's no reason to escape the forward slashes for your closing tags since you changed the pattern delimiter to %. Also, you have some unescaped single quotes in the part that attempts to match the javascript code.
onclick="javascript:popup\('/shipping_tips.asp?'\)

Open in new window

0
 
Ray PaseurCommented:
Let's start with the basics.  Parse error: syntax error, unexpected ',' in /home/public_html/feed.php on line 175

Please show us line 175 and the lines leading up to it.  There are only 21 lines in the script you posted!
0
 
Ray PaseurCommented:
Also, now that I try to read that slug of code, it might be easier to do what ever you are trying if you step back from the technical details and give us two pieces of information.

1. Give us an example of the input data.
2. Give us an example of what you're trying to get as a result, after processing the input data.

Thanks, ~Ray
0
Cloud Class® Course: Ruby Fundamentals

This course will introduce you to Ruby, as well as teach you about classes, methods, variables, data structures, loops, enumerable methods, and finishing touches.

 
käµfm³d 👽Commented:
Note:  those are PHP-related escapes, not regex  : )
0
 
rlb1Author Commented:
Thank you Kaufmed!


Ray,
From here on out, please do not respond to my questions.  Every question that you resond to of mine reflects your "holier than thou" attitude!  I have had enough of it!  There are a lot of people such as Kaufmed who have taken a geniune interest in trying to help me instead of insulting me with "slug of code", etc.

If I was a PHP god, and CEO of a huge company like you, I would not be asking questions!   I am still trying to learn - at my pace!  

Sincerely,

Randy
0
 
Ray PaseurConnect With a Mentor Commented:
Randy: "Slug" is not a pejorative - it is a term of art.  Please do not be offended by it, any more than you would be offended by "block" or "segment."  Instead, let's try to work together:

1. Give us an example of the input data.
2. Give us an example of what you're trying to get as a result, after processing the input data.

Armed with that information we can give you a good answer.

EE does not give us a way to filter out questions by the author name or the expert name.  I have asked for this feature in the past and I have been told it will not be made available.  Sorry - that is just the way it is.
0
 
rlb1Author Commented:
Got it to work after about 3 hours of working on it and trying different things.  Thanks!
0
 
rlb1Author Commented:
Thanks!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.