I am working with the following block of code:
<li class="standby" id="id4">
<a href="www.google.com" target="_self" title="Contact Information"> Contact Information<font class="menuItemType">(BB)</font></a></LI>
<li class="standby" id="id5">
<a href="www.google.com" target="_self" title="Contact Information"> Contact Information<font class="menuItemType">(BB)</font></a></LI>
<li class="standby" id="id6">
<a href="www.google.com" target="_self" title="Contact Information"> Contact Information<font class="menuItemType">(BB)</font></a></LI>
<li class="standby" id="id7">
<a href="www.google.com" target="_self" title="Contact Information"> Contact Information<font class="menuItemType">(BB)</font></a></LI>
I have com across quite a few different patterns, but I can not seem to get any to work for what I need. I have been working with /^(?:<li>.*?</li>\s*)/
but I know it's way off. Basically I need to use regex to find and remove an LI based on the Id, which will be handled dynamically. so if the above were a menu, I would need to remove 5 for example. If I can get the regex working to highlight 5 for example in http://regexpal.com/ I should be able to wrap this up.
Update: I need to use a non js based function to accomplish this, so no jquery. specifically I am using the : http://cfquickdocs.com/cf9/#rematchnocase
Thank you to my teammate @Alex Brown for the updated regex functions, @Paul Alexander for the correct direction on the php/cf versions and @Splash-x @nnnnn for the jquery versions I needed. here is a test case for the cf side, will update once I get the jquery setup:
<cfsavecontent variable="Psuedo">
<li class="standby" id="id4">
<a href="www.google.com" target="_self" title="Contact Information"> Contact Information<font class="menuItemType">(BB)</font></a></LI>
<li class="standby" id="id5">
<a href="www.google.com" target="_self" title="Contact Information"> Contact Information<font class="menuItemType">(BB)</font></a></LI>
<li class="standby" id="id6">
<a href="www.google.com" target="_self" title="Contact Information"> Contact Information<font class="menuItemType">(BB)</font></a></LI>
<li class="standby" id="id7">
<a href="www.google.com" target="_self" title="Contact Information"> Contact Information<font class="menuItemType">(BB)</font></a></LI>
</cfsavecontent>
<cfscript >
t=structNew();
//find one and kill it
t.Psuedo=Psuedo;
t.1.testCase1='<li[^>]*?id="id5".*?li>';
t.1.after1=reReplaceNoCase(t.Psuedo,t.1.testCase1,"","All");
t.1.testCase2='<li[^>]*?id="id4".*?li>';
t.1.after2=reReplaceNoCase(t.1.after1,t.1.testCase2,"","All");
t.1.testCase3='<li[^>]*?id="id7".*?li>';
t.1.after3=reReplaceNoCase(t.1.after2,t.1.testCase3,"","All");
//find more than 1 and kill them
t.2.testCase1='<li[^>]*?id="id(5|7)".*?li>';
t.2.after1=reReplaceNoCase(t.Psuedo,t.2.testCase1,"","All");
</cfscript>
<cfdump var="#t#">