A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Find and Replace with Wildcards



 
 
Thread Tools Display Modes
  #1  
Old August 7th, 2004, 04:39 PM
Luke Muehlhauser
external usenet poster
 
Posts: n/a
Default Find and Replace with Wildcards

I've been trying to figure out how to use find and replace in Microsoft
Word XP with wild cards. I read through
http://word.mvps.org/FAQs/General/UsingWildcards.htm and still wasn't able
to figure it out.

Here's what I want to do:

I have a large text file. Here is an excerpt:
--------
h21910-1919/h2
i20 films seen: 4 feature-length, 16 short/iol
liBirth of a Nation, The (1915)
liBroken Blossoms (1919)
liImmigrant, The (1917) [short]
liEasy Street (1917) [short]
liRink, The (1916) [short]
li(none yet)
li(none yet)
li(none yet)
li(none yet)
li(none yet)/ol
bAlso Recommended: /bWinsor McCay, the Famous Cartoonist of the N.Y.
Herald and His Moving Comics (1911) [short]; Cameraman's Revenge, The
(1912) [short]; Pool Sharks (1915) [short]; Tramp, The (1915) [short];
Champion, The (1915) [short]; Ask Father (1919) [short];
bMeh: /bLast Days of Pompeii, The (1913); Intolerance (1916); For His
Son (1912) [short]; Aeroplane Flight and Wreck (Piloted by M. Cody) (1910)
[short]; Girl and Her Trust, The (1912) [short]; Bangville Police (1913)
[short]; By the Sea (1915) [short]; Butcher Boy, The (1917) [short];
Adventurer, The (1917) [short];
bGarbage: /b
---------

What I want to do is fix it so that all instances of [movie title],
[leading article] are switched to [leading article] [movie title].

I turned wildcards on and did a find and replace using the following values
for starters:

Find (without quotes): "; *; The"
Replace (without quotes): "; The *"

But, apparently * only works as a wildcard in find, and not replace (I
ended up with "; The *").

Does anyone know how to use wild cards in find and replace correctly to
accomplish what I like? Then I will adapt whatever you can tell me for use
with other articles and positions of movie titles (for example, after li
and /b instead of .

THANKS TO ANYONE WHO CAN HELP!!!!
  #2  
Old August 7th, 2004, 05:32 PM
Graham Mayor
external usenet poster
 
Posts: n/a
Default Find and Replace with Wildcards

I have rewritten the article for my own web site to try and make it
clearer - see http://www.gmayor.com/replace_using_wildcards.htm but there
appears no simple way to do this as there is no unique string that can be
easily be selected. * is rather a blunt weapon

You replace wildcards by using brackets and slashed numbers eg The following
will step through the text, but will find more than just the items you
require so you will have to select next until the required string is found
then replace it.

(; )(*)[,] (The) \(

Replace with

\1\3 \2\4 (

I might have been able to tie it down even tighter had I had access to the
original document, but this should get you started.

--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org




Luke Muehlhauser wrote:
I've been trying to figure out how to use find and replace in
Microsoft Word XP with wild cards. I read through
http://word.mvps.org/FAQs/General/UsingWildcards.htm and still wasn't
able to figure it out.

Here's what I want to do:

I have a large text file. Here is an excerpt:
--------
h21910-1919/h2
i20 films seen: 4 feature-length, 16 short/iol
liBirth of a Nation, The (1915)
liBroken Blossoms (1919)
liImmigrant, The (1917) [short]
liEasy Street (1917) [short]
liRink, The (1916) [short]
li(none yet)
li(none yet)
li(none yet)
li(none yet)
li(none yet)/ol
bAlso Recommended: /bWinsor McCay, the Famous Cartoonist of the
N.Y. Herald and His Moving Comics (1911) [short]; Cameraman's
Revenge, The (1912) [short]; Pool Sharks (1915) [short]; Tramp, The
(1915) [short]; Champion, The (1915) [short]; Ask Father (1919)
[short]; bMeh: /bLast Days of Pompeii, The (1913); Intolerance
(1916); For His Son (1912) [short]; Aeroplane Flight and Wreck
(Piloted by M. Cody) (1910) [short]; Girl and Her Trust, The (1912)
[short]; Bangville Police (1913) [short]; By the Sea (1915) [short];
Butcher Boy, The (1917) [short]; Adventurer, The (1917) [short];
bGarbage: /b
---------

What I want to do is fix it so that all instances of [movie title],
[leading article] are switched to [leading article] [movie title].

I turned wildcards on and did a find and replace using the following
values for starters:

Find (without quotes): "; *; The"
Replace (without quotes): "; The *"

But, apparently * only works as a wildcard in find, and not replace (I
ended up with "; The *").

Does anyone know how to use wild cards in find and replace correctly
to accomplish what I like? Then I will adapt whatever you can tell me
for use with other articles and positions of movie titles (for
example, after li and /b instead of .

THANKS TO ANYONE WHO CAN HELP!!!!



  #3  
Old August 8th, 2004, 02:55 AM
Greg Maxey
external usenet poster
 
Posts: n/a
Default Find and Replace with Wildcards

Luke,

It may be due to how your example came across, but I can't find anyway to
find and replace all instances.

Using your example, the best I could find was:

Find:

;([!;,]{1,}),( The)

This starts with a semicolon, finds everything but a semicolon and comma up
to a comma, finds the comma, a space and the word The. It groups everything
from the semicolon up to the comma as group 1 and The as group 2. Then we
simply replace the semicolon with itself and reverse the groups

Replace:

;\2\1

Which worked with:
The Cameraman's Revenge, The Tramp, The Adventurer, The Butcher Boy and The
Girl and Her Trust

It missed Birth of a Nation, The/Immigrant, The and Rink, The because there
is no ";" tag at the begining of these lines.

You can pick up these three with

li\([!,]{1,}), (The)

and

li\2 \1

That leaves Last Days of Pompei, The

As you can see, there is no common string in your structure to ensure each
instance is picked up. Maybe there is and I just don't see it.





--
Greg Maxey
A peer in "peer to peer" support
Rockledge, FL
To e-mail, edit out the "w...spam" in

Luke Muehlhauser wrote:
I've been trying to figure out how to use find and replace in
Microsoft Word XP with wild cards. I read through
http://word.mvps.org/FAQs/General/UsingWildcards.htm and still wasn't
able to figure it out.

Here's what I want to do:

I have a large text file. Here is an excerpt:
--------
h21910-1919/h2
i20 films seen: 4 feature-length, 16 short/iol
liBirth of a Nation, The (1915)
liBroken Blossoms (1919)
liImmigrant, The (1917) [short]
liEasy Street (1917) [short]
liRink, The (1916) [short]
li(none yet)
li(none yet)
li(none yet)
li(none yet)
li(none yet)/ol
bAlso Recommended: /bWinsor McCay, the Famous Cartoonist of the
N.Y. Herald and His Moving Comics (1911) [short]; Cameraman's
Revenge, The (1912) [short]; Pool Sharks (1915) [short]; Tramp, The
(1915) [short]; Champion, The (1915) [short]; Ask Father (1919)
[short]; bMeh: /bLast Days of Pompeii, The (1913); Intolerance
(1916); For His Son (1912) [short]; Aeroplane Flight and Wreck
(Piloted by M. Cody) (1910) [short]; Girl and Her Trust, The (1912)
[short]; Bangville Police (1913) [short]; By the Sea (1915) [short];
Butcher Boy, The (1917) [short]; Adventurer, The (1917) [short];
bGarbage: /b
---------

What I want to do is fix it so that all instances of [movie title],
[leading article] are switched to [leading article] [movie title].

I turned wildcards on and did a find and replace using the following
values for starters:

Find (without quotes): "; *; The"
Replace (without quotes): "; The *"

But, apparently * only works as a wildcard in find, and not replace (I
ended up with "; The *").

Does anyone know how to use wild cards in find and replace correctly
to accomplish what I like? Then I will adapt whatever you can tell me
for use with other articles and positions of movie titles (for
example, after li and /b instead of .

THANKS TO ANYONE WHO CAN HELP!!!!



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Find and Replace Wildcards Matthew New Users 2 June 9th, 2004 06:47 PM
Find and Replace in Word 97 Doug Robbins - Word MVP General Discussion 1 May 28th, 2004 02:41 PM
find all / replace all used in a selected range oldguy Worksheet Functions 0 February 26th, 2004 02:05 PM
find all / replace all used in a selected range Tom Turtle Worksheet Functions 0 February 26th, 2004 11:11 AM
Find #DIV/0! Error and Replace Dave Peterson Worksheet Functions 5 January 12th, 2004 07:18 PM


All times are GMT +1. The time now is 04:57 PM.


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