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 - VBScript RegEx vs ECMA 262

Reply
 
Old 06-28-2009   #1 (permalink)
Ron Rosenfeld


 
 

VBScript RegEx vs ECMA 262

I had read that Microsoft VBScript Regular Expressions 5.5 conformed to
ECMA-262 with some exceptions in the replacement text.

In using VBA 6.5 (under Excel 2007), it appears that <nbsp> (Hex code A0) is
not included in the "white space" character class.

Is this another area of non-conformance with ECMA-262? Or is there something
wrong with my setup.

And yes, I am aware that the MS web site documentation indicates that \s is
equivalent to [ \f\n\r\t\v] which clearly does not include <nbsp> in that
class. But I just wanted to confirm that what others have written is in error
(or that I am doing something wrong).

Here is VBA code that demonstrates this:


==================================
Option Explicit
Sub TestNBSP()
Dim NBSP As String
Dim oRE As RegExp
Const sPat1 As String = "\xA0"
Const sPat2 As String = "\s"
Const sPat3 As String = "\S"

NBSP = Chr(160)

Set oRE = New RegExp
oRE.Pattern = sPat1
Debug.Print oRE.Pattern, oRE.Test(NBSP)
oRE.Pattern = sPat2
Debug.Print oRE.Pattern, oRE.Test(NBSP)
oRE.Pattern = sPat3
Debug.Print oRE.Pattern, oRE.Test(NBSP)
End Sub
=====================================
Immediate window:

\xA0 True
\s False
\S True
------------------------------------

--ron

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Regex help please? PowerShell
How to do No hang up VBScript (nohup for VBScript) VB Script
regex help PowerShell
regex PowerShell
Ecma International Approves Office Open XML as Worldwide Industry Standard Vista News


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