|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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. |
|
#2
|
||||
|
||||
|
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 |
|
#3
|
|||
|
|||
|
|
![]() |
| Viewing: ASP Free Forums > Programming > HTML, JavaScript And CSS Help > Regular Expression in VBSCRIPT?? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|