Jump to content
UBot Underground

$replace multiple strings on a single list item?


Recommended Posts

Say I want to remove all punctuation from a string. I need to drop '!?.!@#$%^, etc. I'm trying to drop them by doing something like so...

 

set

#variable1

$replace

-> $next list item

-> .

-> $nothing

 

set

#variable2

-> #variable1

-> ,

-> $nothing

 

set

#variable3

-> #variable2

-> ?

-> $nothing

 

and so on...

 

 

 

Doesn't seem to be working for me though. In my current application I am looking to remove spaces and quotations.

 

How do I go about replacing multiple strings within a list item? Drawing blanks here...

Link to post
Share on other sites

Maybe I'm just not seeing it, but I fail to see where the replacement is happening there at all.

 

What I have is a list, that I want to remove certain parts from. Another good example would be something like an html snippet that you want to remove all italics and bold font styles from.

 

 

<p>

The dog walked <strong>across</strong> the road

</p>

<p>The cat ran <em>away from</em> the dog.

</p>

 

 

So I'd have to replace <strong>, </strong>, <em>, & </em> all with a $nothing variable.

 

Now i can easily take one of those strings of text out, but it's the next one where I have problems. At least moving from removing all spaces, on to removing all ' & " I'm having difficulties. I can get the spaces all out, but then getting rid of the quotations and other invalid characters does not work.

 

I am stripping down keyphrases for input into a form. occasionally the phrases contain an invalid character, I need to strip all of these invalid characters down.

 

The snippet posted seems to remove entire lines from the list. I need to remove characters (or entire strings in the case of the HTML example) from each item.

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...