Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 05-29-2012, 06:23 AM
tinfanide tinfanide is offline Regular Expressions: [!0-9] does not work??? Windows 7 64bit Regular Expressions: [!0-9] does not work??? Office 2010 32bit
Expert
Regular Expressions: [!0-9] does not work???
 
Join Date: Aug 2011
Posts: 312
tinfanide is on a distinguished road
Default Regular Expressions: [!0-9] does not work???

Code:
Sub test()

Dim str As String
str = "str 9999 9999 str"

Dim RegExp As Object
Set RegExp = CreateObject("vbscript.regexp")

With RegExp
    .IgnoreCase = True
    .MultiLine = False
    .Pattern = "[!0-9]"
    .Global = True
End With

output = RegExp.Replace(str, "")
MsgBox output

Set RegExp = Nothing

End Sub
I can't understand why [a-z] can extract the numbers but why [!0-9] can't.
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Regular Expressions: [!0-9] does not work??? work vs regular work. and how regular work works user0044 Project 5 03-06-2012 07:28 AM
Regular Expressions: [!0-9] does not work??? regular Expressions Formatting for Search sesproul Mail Merge 1 11-30-2011 05:02 AM
Regular Expressions: [!0-9] does not work??? Access 2003 says unsafe expressions not blocked, but only some users on same computer ZLA Office 3 07-23-2010 10:00 AM
Issue skipping characters by Regular Expressions in Word pochtara Word VBA 0 04-01-2010 05:37 AM
How do I have headers and footers appear as regular text for the whole document? user908045 Word 0 03-13-2010 12:41 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 11:01 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft