Jump to content
UBot Underground

How do you remove specific items on a list


Recommended Posts

I'm trying to remove a certain item from a list.

In fact, it's list with profile urls only.

The url i want to remove from the list ,could be anywhere.

 

I tried this but it doesn't work

 

set(#remove$replace(%profileurls"http://thestaff.site.com/"$nothing), "Global")

or
    set(#remove$replace regular expression(%profileurls"http://thestaff.site.com/"$nothing), "Global")

 

So how do you remove specific things on a list ?

In this case:

http://thestaff.site.com/

 

Thanks

 

 

Link to post
Share on other sites

Here is the code you are looking for, it will remove selected item from a list:

ui drop down("Remove From List:", "a,b,http://thestaff\\.site\\.com/,c,d", #REMOVE String)
clear list(%LIST)
clear list(%LIST Original)
add list to list(%LIST Original, $list from text("a,b,http://thestaff.site.com/,c,d", ","), "Delete", "Global")
add list to list(%LIST, $list from text($replace regular expression(%LIST Original, "(?<=\\n|^){#REMOVE String}(?=\\n|$)", $nothing), $new line), "Delete", "Global")

However, I need to warn you that this code could behave unpredictable if original list contains items with new line character inside them. Because of that I suggest you use this approach instead:

  1. find list item position (manually by looping through list)
  2. remove list item with "remove from list" command

Alternatively you could also find list item position by moving original list to a table and use "$table search" function there., then you use that integer in "remove from list" command

  • Like 1
Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...