jewcat 0 Posted March 15, 2010 Report Share Posted March 15, 2010 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... Quote Link to post Share on other sites
alcr 135 Posted March 15, 2010 Report Share Posted March 15, 2010 Take a look at this one, not exactly what you're working on, but it will give you a nice understanding Quote Link to post Share on other sites
jewcat 0 Posted March 15, 2010 Author Report Share Posted March 15, 2010 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. Quote Link to post Share on other sites
bluegoat 24 Posted March 16, 2010 Report Share Posted March 16, 2010 This should give you some ideas...multiple replace.ubot 1 Quote Link to post Share on other sites
jewcat 0 Posted March 16, 2010 Author Report Share Posted March 16, 2010 So simple I'm embarrassed to have not thought of it myself. Nice loop action happening. Thanks bluegoat! Quote Link to post Share on other sites
crazyflx 22 Posted March 16, 2010 Report Share Posted March 16, 2010 That was nice bluegoat! Quote Link to post Share on other sites
Cornerstone 0 Posted March 17, 2010 Report Share Posted March 17, 2010 Yes thank you Great for us non programersI look forward to when I can contribute some of my bots as well Quote Link to post Share on other sites
bluegoat 24 Posted March 17, 2010 Report Share Posted March 17, 2010 No problem Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.