Re: small simple regexp favor




I LOVE YOU MAN THANKS SO MUCH!!!

-Aaron



ekkehard.horner wrote:
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

.