Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7678829
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T17:44:13+00:00 2026-05-31T17:44:13+00:00

I am currently working with the following pseudo code block to fix a regex

  • 0

I am currently working with the following pseudo code block to fix a regex problem I am running into. currently I am using regex to find/remove various menu items based by id, however, it is only working for children, not the parent records. so in this example I am trying to remove id53 and if you run the pseudo code you will see it breaks the structure of the tree b/c it does not remove the entire <li></li> block.

anyone have any ideas on how to adjust the regex test pattern we are working with? I really appreciate your help and hope you have a great week.

<cfsavecontent variable="pseudo">
<ul id="nav-main-links">
    <li class="standby" id="id61"><a href="/?event=User.Home.dspHome" target="_self" title="Home"> Home<font class="menuItemType">(CB)</font></a>
    <li class="standby" id="id53"><a href="/contactus.cfm" target="_self" title="Contacts"> Contacts<font class="menuItemType">(L)</font></a>
    <ul class="sub-nav-main-links nestingLevel1">
        <li class="standby" id="id54"><a href="http://test/index.cfm" target="_self" title="Ven"> Ven<font class="menuItemType">(X)</font></a></li>
        <li class="standby" id="id55"><a href="http://test/spEvents.cfm" target="_self" title="SponsorShip"> SponsorShip<font class="menuItemType">(L)</font></a></li>
    </ul>
    </li>
</ul>
</cfsavecontent>
<cfscript>
    myDisplay=structnew();
    myDisplay.pseudo=pseudo;
    myDisplay.IdsToRemove="53";
    myDisplay.RegExTestPattern='<li[^>]*?id="id(' & myDisplay.IdsToRemove & ')".*?li>';
    myDisplay.Menu=reReplaceNoCase(myDisplay.pseudo,myDisplay.RegExTestPattern,"","All");   
</cfscript>
<cfdump var="#myDisplay#">
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-31T17:44:14+00:00Added an answer on May 31, 2026 at 5:44 pm

    Writing a regex solution would need a recursive regex, and I don’t know whether CFML supports that. As I commented, XML DOM manipulation is the way to go. It would look something like this (untested as I have no access to a ColdFusion server.

    <cfsavecontent variable="pseudo">
    <ul id="nav-main-links">
      <li class="standby" id="id61"><a href="/?event=User.Home.dspHome" target="_self" title="Home"> Home<font class="menuItemType">(CB)</font></a>
      <li class="standby" id="id53"><a href="/contactus.cfm" target="_self" title="Contacts"> Contacts<font class="menuItemType">(L)</font></a>
      <ul class="sub-nav-main-links nestingLevel1">
        <li class="standby" id="id54"><a href="http://test/index.cfm" target="_self" title="Ven"> Ven<font class="menuItemType">(X)</font></a></li>
        <li class="standby" id="id55"><a href="http://test/spEvents.cfm" target="_self" title="SponsorShip"> SponsorShip<font class="menuItemType">(L)</font></a></li>
      </ul>
      </li>
    </ul>
    </cfsavecontent>
    
    <cfscript>
    
      myDisplay=structnew();
      myDisplay.IdsToRemove = "53";
      idVal = 'id' & myDisplay.IdsToRemove;
    
      xmlTree = xmlParse(pseudo);
      liList = xmlSearch(xmlTree, '//li[@id="' & idVal & '"]');
      arrayDeleteAt(liList, 0);
    
      myDisplay.pseudo = toString(xmlTree);
    
    </cfscript>
    
    <cfdump var="#myDisplay#">
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following problem using subversion: I'm currently working on the trunk of
I am currently working on Problem 62 I have tried the following code to
The following code generates a similar dataset to what I am currently working with:
I am currently working on a project that requires to solve the following problem:
Currently working on a project in MVC-3. Trying to put the following code in
hi iam currently working in simple amimation app in which i implement following code
So at the moment my page is currently working with the following code in
I'm currently working with the following code: $(li.className).click(function () { $(this).fadeTo(1000, 0); }); which
I'm currently working on a Java project that is emitting the following warning when
I`m currently working on a script, and I have the following situation. function somnicefunction()

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.