Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - RegExp pattern to escape ALL special characters (but exclude unicodechars)

Reply
 
Old 12-22-2008   #1 (permalink)
Gabriela


 
 

RegExp pattern to escape ALL special characters (but exclude unicodechars)

Hi,
I'd like to write a regexp that converts all special chars to "-".
I've used this pattern
[^a-z0-9]
with ignore case, and it works beautifully.
BUT - I want to support also unicode chars (and not escape them).
I could not find a way to do it, except for listing all special
characters "manually" and escaping them. I'd rather prepare
"whitelist" - of the chars allowed, then a "blacklist" of all special
chars.
Any ideas?
Thanx,
Gabi

My System SpecsSystem Spec
Old 12-22-2008   #2 (permalink)
Evertjan.


 
 

Re: RegExp pattern to escape ALL special characters (but exclude unicode chars)

Gabriela wrote on 22 dec 2008 in microsoft.public.scripting.vbscript:
Quote:

> I'd like to write a regexp that converts all special chars to "-".
> I've used this pattern
> [^a-z0-9]
[^a-z\d]
Quote:

> with ignore case, and it works beautifully.
> BUT - I want to support also unicode chars (and not escape them).
Ascii chars are also unicode chars.
Quote:

> I could not find a way to do it, except for listing all special
> characters "manually" and escaping them. I'd rather prepare
> "whitelist" - of the chars allowed, then a "blacklist" of all special
> chars.
if you [wrongly] mean by "unicode chars" all chars above ff:

[^a-z\d\u0100-\uffff]

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Using special characters on my tagline Live Messenger
Replace special characters VB Script
Password with special characters Live Mail
Special Characters - how? Vista General
How to run program with special characters PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46