HTML, JavaScript And CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsProgrammingHTML, JavaScript And CSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old September 11th, 2003, 05:55 AM
abones abones is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Posts: 17 abones User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Regular Expression in VBSCRIPT??

Does VBScript support regular expression? IF a want to whether a string contained any illegal characters i defined in a string, how should i do that?

E.g invalidchar = "~!@#$%^&*(){}][;;<>?"'."
value from textbox = "testing ^ 123"
=> Check and show msgbox to user to indicate that string contain
illegal characters.

Reply With Quote
  #2  
Old September 11th, 2003, 07:25 AM
Silian's Avatar
Silian Silian is offline
Gogga
ASP Free Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: A long, long time ago, in a galaxy, far, far away...
Posts: 34 Silian User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
There might be an easier way to do this, but I would have inserted everything that shouldn't be in the string in an array

invalidChar = "~,!,@,#,$,%,^,&,*,(,),{,},],[,;,;,<,>,?,"",',."
invalidArray = split(invalidChar,",")

Then go throught the array, and use the instr function 2 check if it is in the string

for i = 0 to (ubound(invalidArray) - 1)
if inStr(myString, invalidArray(i)) = 0 then
'illegal character
end if
next

Reply With Quote
  #3  
Old September 11th, 2003, 12:50 PM
Doug G Doug G is offline
Grumpier Old Moderator
ASP Free God 11th Plane (10000 - 10499 posts)
 
Join Date: Sep 2003
Posts: 10,143 Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level)Doug G User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 3 Weeks 4 Days 23 h 9 m 23 sec
Reputation Power: 181
VBScript has a RegEx object. Take a look here

http://msdn.microsoft.com/library/e...vsobjRegExp.asp

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingHTML, JavaScript And CSS Help > Regular Expression in VBSCRIPT??


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT