LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 161
Default regEx replace

If a substring is found that matches my regular expression
pattern, I would like each character to be replaced with a
"*" character. I thought the following code would work,
but I'm missing something? :

'--------------------------------------------------------
Sub myregex()
Dim regEx As New VBScript_RegExp_55.RegExp
Dim str As String

str = "Call me at (982)555-1234!"

regEx.Pattern = "(...)...-...."
regEx.Global = True
regEx.IgnoreCase = True

MsgBox regEx.Replace(str, "*")

End Sub




 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Regex Pattern Geoff K Excel Programming 5 June 12th 09 12:49 AM
Regex as replace function Excel Monkey[_2_] Excel Programming 3 May 7th 09 06:46 PM
Help with a regex pattern please [email protected] Excel Programming 3 March 22nd 08 12:14 AM
Help with a Regex Pattern [email protected] Excel Programming 11 April 30th 07 01:49 AM
Regex techniques Dave Runyan Excel Programming 5 April 28th 07 12:17 AM


All times are GMT +1. The time now is 09:47 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"