![]() |
#1
|
|||
|
|||
![]()
I want to match
Quote:
Quote:
Code:
Sub RegExp() Dim oRegExp As RegExp Dim oMatchCollection As MatchCollection Dim oMatch As Match Set oRegExp = New RegExp '' oRegExp.Pattern = """.*JPG""" '' return: '' "images/folder 1/pic 009.JPG" desc="desc 1" /><pic path="images/folder 1/pic 010.JPG" oRegExp.Global = True oRegExp.IgnoreCase = True '' oRegExp.MultiLine = False Set oMatchCollection = oRegExp.Execute(ActiveDocument.Range) For Each oMatch In oMatchCollection Debug.Print oMatch.Value Next oMatch Set oMatch = Nothing Set oMatchCollection = Nothing Set oRegExp = Nothing End Sub |
#2
|
||||
|
||||
![]()
If this is for Word, why not use its wildcard facilities?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
![]()
Can you give a hint, please?
|
#4
|
||||
|
||||
![]()
Since I don't know what you want to do with the found text, this is fairly generic:
Code:
With ActiveDocument.Content With .Find .ClearFormatting .Replacement.ClearFormatting .Text = """images/folder 1/pic [0-9]{3}.JPG""" .Replacement.Text = "" .Forward = True .Wrap = wdFindStop .Format = False .MatchWildcards = True .Execute End With Do While .Find.Found MsgBox .Text .Find.Execute Loop End With
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Bobosmite | Word | 5 | 04-15-2013 06:40 AM |
![]() |
SusanG | Word | 2 | 06-06-2012 11:58 PM |
![]() |
tinfanide | Excel Programming | 4 | 05-30-2012 04:09 AM |
Exporting without Quotes | Chris1 | Excel | 6 | 02-16-2012 11:20 PM |
Issue skipping characters by Regular Expressions in Word | pochtara | Word VBA | 0 | 04-01-2010 05:37 AM |