Re: Find and Replace with Wildcards

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Greg Maxey (gmaxey_at_whamspammvps.org)
Date: 08/08/04


Date: Sun, 08 Aug 2004 01:55:10 GMT

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 gmaxey@whamspammvps.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:
> --------
> <h2>1910-1919</h2>
> <i>20 films seen: 4 feature-length, 16 short</i><ol>
> <li>Birth of a Nation, The (1915)
> <li>Broken Blossoms (1919)
> <li>Immigrant, The (1917) [short]
> <li>Easy Street (1917) [short]
> <li>Rink, The (1916) [short]
> <li>(none yet)
> <li>(none yet)
> <li>(none yet)
> <li>(none yet)
> <li>(none yet)</ol>
> <b>Also Recommended: </b>Winsor 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]; <b>Meh: </b>Last 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];
> <b>Garbage: </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!!!!


Relevant Pages

  • Re: American semicolons
    ... claim that Americans 'only use ";" to separate two things that would ... semicolon can be a strong comma as well as weak period. ...
    (alt.usage.english)
  • Re: Macro crashing on different computer
    ... >ConsecutiveDelimiter, Tab, Semicolon, Comma, Space, ... >FieldInfo, DecimalSeparator, ThousandsSeparator) ...
    (microsoft.public.excel.programming)
  • Re: Cannot multiselect programmatically?
    ... I am just using the semicolon to separate the items in the list (and to end ... > comma-delimitd list but the comma is not part of the list value. ... >> items in the listbox already selected by default when the form is loaded. ... How do I programmatically select multiple items in the list? ...
    (microsoft.public.fox.programmer.exchange)
  • Re: comma operator
    ... may have returned has been discarded by the comma; ... and the semicolon at the end discards the value ... extra gyrations to make the second function ...
    (comp.lang.c)
  • Re: Form field formatting
    ... Panel> Regional and Language settings to a space vice a comma but I still ... A Peer in Peer to Peer Support ... Ricki Miles wrote: ... >> Now I see your problem, I just selected the standard format ...
    (microsoft.public.word.formatting.longdocs)