Re: small simple regexp favor



aaron.kempf@xxxxxxxxx wrote:
Can you guys PLZ PLZ PLZ write me a regexp string to filter out
anything other than A-Z 1-0 and also allow these 5 special characters??

/
:
\
.
And {space}

Again; allow anything from A-Z and from 1-0 and also allow these 5
special characters:
Backslash, forwardslash, period, space, colon

Thanks

-Aaron

Try this

Dim aTests : aTests = Array( "AZ01\/. :" , "AZ01\/. :" _
, "az01\/. :" , "01\/. :" _
, "AZ23\/. :" , "AZ\/. :" _
, "BC10\/. :{=´", "BC10\/. :" _
)
Dim oRE : Set oRE = New RegExp
' allow=keep anything from A-Z and from 1-0 and also allow these 5
' special characters: Backslash, forwardslash, period, space, colon
oRE.Pattern = "[^A-Z0-1\\/. :]"
oRE.Global = True

Dim nIdx, sMsg, sRes
For nIdx = 0 To UBound( aTests ) Step 2
sMsg = nIdx & " |" + aTests( nIdx ) + "| => |"
sRes = oRE.Replace( aTests( nIdx ), "" )
sMsg = sMsg + sRes + "| => " + CStr( sRes = aTests( nIdx + 1 ) )
WScript.Echo sMsg
Next

.



Relevant Pages

  • Re: 128 bit password
    ... If a password is for example 128bit, how long is it in characters (a-z ... If the password is "THISisMYpassword". ... It's the level of coding the security ...
    (microsoft.public.security)
  • preg_match allowing a-z AND å ä ö ü
    ... lowercase) characters of A-Z, 0-9 and for instance Swedish characters Å Ä Ö. ... but both returns false on everything except a-z A-Z. ... e-mail header causing the e-mail to fail. ...
    (comp.lang.php)
  • Re: small simple regexp favor
    ... anything other than A-Z 1-0 and also allow these 5 special characters?? ... Dim oRE: ... Dim nIdx, sMsg, sRes ...
    (microsoft.public.scripting.vbscript)
  • Re: RegExp Help
    ... Sometimes users provide illegal or unsupported characters for the name ... Set regEx = New RegExp ... Dim oRE: ... Dim nIdx, sRslt, sMsg ...
    (microsoft.public.scripting.vbscript)
  • Re: FASTEST way to try all strings (a until ZZZZZZZZZZZZZZZZZZZZZZZZ)
    ... DraguVaso wrote: ... Even using just 17 characters ... With 53 symbols (a-z, A-Z, space) you get ... of repeated string concatenation would be a good start. ...
    (microsoft.public.dotnet.languages.vb)