Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


Remove all non AlphaNumeric characters from String

 
Logged in as: Guest
arrSession:exec spGetSession 2,16,26939
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> Post a VBScript >> Remove all non AlphaNumeric characters from String
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 Remove all non AlphaNumeric characters from String - 10/13/2005 11:28:27 PM   
  mbouchard


Posts: 1804
Score: 12
Joined: 5/15/2003
From: USA
Status: online
Remove all non Alpha numeric characters from a string.  This will include spaces.  If you want to keep a character, add it to the strAlphaNumeric string below
Note: Tested on Windows XP sp2 but should work on any wscript install.


      

_____________________________

Mike

For useful Scripting links see the Read Me First stickey!

Always remember Search is your friend.
 
 
Post #: 1
 
 RE: Remove all non AlphaNumeric characters from String - 10/23/2005 9:57:48 AM   
  Fredledingue


Posts: 321
Score: 0
Joined: 5/9/2005
From:
Status: offline
I found another code for that, but I think your code is faster and smaller.

This is the code. I use it basicaly to remove text stream errors as it's working with ascii numbers.
Just for infomation


      

_____________________________

Fred

(in reply to mbouchard)
 
 
Post #: 2
 
 RE: Remove all non AlphaNumeric characters from String - 12/21/2005 6:08:09 AM   
  ebgreen


Posts: 4595
Score: 29
Joined: 7/12/2005
Status: offline
Here is a Regex alternative.

Set oRE = New Regexp
oRE.Pattern = "[\W_]"
oRE.Global = True
theString= "This*&(*&^%is_                          The&^%&^%><><.,.,.,';';';  String"
WScript.Echo oRE.Replace(theString, "")

_____________________________

"... when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick
Goog places to start:http://www.visualbasicscript.com/m_24727/tm.htm
http://www.visualbasicscript.com/m_47117/tm.htm

(in reply to Fredledingue)
 
 
Post #: 3
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> Post a VBScript >> Remove all non AlphaNumeric characters from String Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts