Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    Regular Coder
    Join Date
    Apr 2012
    Location
    St. Louis, MO
    Posts
    985
    Thanks
    7
    Thanked 101 Times in 101 Posts

    Unhappy RegEx + string literal + RegEx ?

    Hello, everyone.

    Is it possible to use a RegEx plus a string plus RegEx to .split() on a string?

    Basically put, I'm trying to code a function that will remove a specific user+userID (and other info) from an element .html() value. There is a <div></div> before the name (CSS gives it a "delete" icon) and a <br> after the name (except for the last name in the list - which is causing me the problem.)

    Is it possible to take an argument in a function (like the UUID) and pass it as a literal in the middle of a RegEx mask for the .split()?

    The .html() value will be something like:
    Code:
    <div onclick="removeUser'(\'A1234\',\'John Doe\');" class="deleteIcon"></div>John Doe<br>
    <div onclick="removeUser'(\'B2345\',\'Zaphod Beeblebrox\');" class="deleteIcon"></div>Zaphod Beeblebrox<br>
    <div onclick="removeUser'(\'B3456\',\'Dr. Who\');" class="deleteIcon"></div>Dr. Who<br>
    <div onclick="removeUser'(\'C4567\',\'Smithwicks\');" class="deleteIcon"></div>Smithwicks
    I figure that if I can split on the <div {data}></div>{user name}(possible<br>) and then join on "", that would make it a simple process.

    Right now, I'm splitting on just the name, then trying to clean up all <div></div>(possible <br>) (no name) and it's breaking.
    Last edited by WolfShade; 02-15-2013 at 08:01 PM.
    ^_^

    If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
    *
    The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    26,014
    Thanks
    79
    Thanked 4,436 Times in 4,401 Posts
    Short answer: of course.

    Longer answer: Your explanation was as clear as my cold coffee. Trying to figure out WHAT it is you want to delete from all that.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #3
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    26,014
    Thanks
    79
    Thanked 4,436 Times in 4,401 Posts
    That HTML you show isn't legal. You have <div>'s but not one single matching </div>.

    And what is .html()? Are you talking jQuery? Do you really mean .innerHTML?

    And what, if anything, is the container around all of this?

    Can't you show the real HTML?
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #4
    Regular Coder
    Join Date
    Apr 2012
    Location
    St. Louis, MO
    Posts
    985
    Thanks
    7
    Thanked 101 Times in 101 Posts
    Sorry.. as usual, typing fast, missed something. Edited original post to reflect accurate code.

    Objective: Delete ONE "<div {attributes}></div>{user name}(possible <br>)" from the list based upon a name passed to the function.
    ^_^

    If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
    *
    The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".

  • #5
    Regular Coder
    Join Date
    Apr 2012
    Location
    St. Louis, MO
    Posts
    985
    Thanks
    7
    Thanked 101 Times in 101 Posts
    Nevermind. I just made it easier by giving the same UUID to a div that is wrapped around each "<div {attr}></div>name", eliminated all <br> (which made the sort function break, but I fixed it), and am just using jQuery .remove() on those IDs.
    ^_^

    If anyone knows of a website that can offer ColdFusion help that isn't controlled by neurotic, pedantic jerks* (stackoverflow.com), please PM me with a link.
    *
    The neurotic, pedantic jerks are not the owners; just the people who are in control of the "popularity contest".


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •