Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 01-11-2013, 08:14 AM
tinfanide tinfanide is offline Regular Expressions: match words within quotes? Windows 7 64bit Regular Expressions: match words within quotes? Office 2010 32bit
Expert
Regular Expressions: match words within quotes?
 
Join Date: Aug 2011
Posts: 312
tinfanide is on a distinguished road
Default Regular Expressions: match words within quotes?

I want to match
Quote:
images/folder 1/pic 009.JPG
in the following text:
Quote:
<gallery>


<pic path="images/folder 1/pic 009.JPG" desc="desc 1" />
<pic path="images/folder 1/pic 010.JPG" desc="desc 2" />
</gallery>
but it just matches the part (stated in the comments below in the codes)
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
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Regular Expressions: match words within quotes? Changing single-quotes to double-quotes Bobosmite Word 5 04-15-2013 06:40 AM
Regular Expressions: match words within quotes? Regular expressions: lower case after hyphen SusanG Word 2 06-06-2012 11:58 PM
Regular Expressions: match words within quotes? Regular Expressions: [!0-9] does not work??? 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

Other Forums: Access Forums

All times are GMT -7. The time now is 12:16 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