Re: small simple regexp favor



hey while you're there can you help me force all lower case into upper
case?

I swear; can I mail you a $20 bill or something?

-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

.



Relevant Pages

  • Re: small simple regexp favor
    ... anything other than A-Z 1-0 and also allow these 5 special characters?? ... Dim oRE: ... ' special characters: ... Dim nIdx, sMsg, sRes ...
    (microsoft.public.scripting.vbscript)
  • 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: 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: An experiment
    ... sometimes hyphenated ROT-13)" ... which allows you to build up strings of special characters then place ... Agent, an accented character is left ... a-z), so 'Forté Agent' becomes 'Sbegé Ntrag'. ...
    (rec.arts.sf.written)
  • Re: bit of regexp help ?
    ... I have a string that I want to return a modified version of it. ... not A-Z, a-z or 0-9 to an underscore. ... Rather than target the specific special characters and convert them like this: ... I'd prefer to have some kind of logic like "if it's A-Z, a-z or 0-9 then leave it alone, else replace it with underscore". ...
    (comp.lang.javascript)

Loading