Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS Word Replace 1

Status
Not open for further replies.

samato

Technical User
Apr 26, 2003
37
0
0
US
Sorry if this has been answered, I have looked through the threads and didn't rally find what I needed.

I need to structure a find and replace statement that will find the following...

<UnscrambledDriverLicenseNumber>DS156DS676564</UnscrambledDriverLicenseNumber>

and replace it with...

<UnscrambledDriverLicenseNumber></UnscrambledDriverLicenseNumber>

the issue is, the number I show above, DS156DS676564, will never be the same as it can be a Drivers License from any state so it will never be the same format/sequence of letters and numbers. Basically I want to repalce everything between the "r>" and the "</"

I am willing to do this with a simple macro or VBS if required.
 
You need to use wildcards and search for tag-anything-endtag, but when you use wildcards, the less-than and greater-than symbols have a special meaning in the find string so must be escaped ..

In the Find & Replace Dialog, press "More >>" if need be and then check the "Use Wildcards" checkbox.
Find: [tt][blue]\<UnscrambledDriverLicenseNumber\>*\</UnscrambledDriverLicenseNumber\>[/blue][/tt]
Replace with: [tt][blue]<UnscrambledDriverLicenseNumber></UnscrambledDriverLicenseNumber>[/blue][/tt]

Enjoy,
Tony

------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.

I'm working (slowly) on my own website
 
Or you could use a wildcard Find/Replace input as:
Find = (\<UnscrambledDriverLicenseNumber\>)*(\</UnscrambledDriverLicenseNumber\>)
Replace = \1\2

Cheers
Paul Edstein
[MS MVP - Word]
 
Thank you both, it worked great Tony. I hadn't realized I had to escape the < and> symbols. Once I did that, worked great. Thanks again!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top