Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
Big Rick Big Rick is offline
external usenet poster
 
Posts: 7
Default Search and Replace help.

Hello Folks
I have a document with many thousands of lines. All lines are 12 or so words
each with a "-" somewhere in the middle. I want to be able to swap the words
around to the other side of the "-". The lenght and the amount of the words
can vary.

e.g. if I have:-
apple banana - pear orange plum
wood metal glass - plastic

I want the result to be:-
pear orange plum - apple banana
plastic - wood metal glass

This must work on selected text only as only 3/4 of the document needs
changing, not the whole lot.
Mr Graham Mayor gave me following but it is not quite working. It is only
swapping around the words either side of the " - "

A wildcard replace of
([a-zA-Z]@)( - )([a-zA-Z]@)
with
\3\2\1
on the selected text should work.

So please can Graham or someone else help me out a bit further.

Your help is and always has been very much appreciated.
Thanking you in anticipation.
--
Big Rick
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
JoAnn Paules JoAnn Paules is offline
external usenet poster
 
Posts: 4,241
Default Search and Replace help.

I know what I would do but it's not going to be the way the Wordies would do
it. I'd dump those lines int Excel, swap them around, then put them back
into Word.

--

JoAnn Paules
MVP Microsoft [Publisher]

~~~~~
How to ask a question
http://support.microsoft.com/KB/555375


"Big Rick" wrote in message
...
Hello Folks
I have a document with many thousands of lines. All lines are 12 or so
words
each with a "-" somewhere in the middle. I want to be able to swap the
words
around to the other side of the "-". The lenght and the amount of the
words
can vary.

e.g. if I have:-
apple banana - pear orange plum
wood metal glass - plastic

I want the result to be:-
pear orange plum - apple banana
plastic - wood metal glass

This must work on selected text only as only 3/4 of the document needs
changing, not the whole lot.
Mr Graham Mayor gave me following but it is not quite working. It is only
swapping around the words either side of the " - "

A wildcard replace of
([a-zA-Z]@)( - )([a-zA-Z]@)
with
\3\2\1
on the selected text should work.

So please can Graham or someone else help me out a bit further.

Your help is and always has been very much appreciated.
Thanking you in anticipation.
--
Big Rick


  #3   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Search and Replace help.

Assuming each line ends a paragraph, replace
([a-zA-Z ]@)( - )([a-zA-Z ]@)^13
with
\3\2\1^p
instead
--

Graham Mayor - Word MVP

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



Big Rick wrote:
Hello Folks
I have a document with many thousands of lines. All lines are 12 or
so words each with a "-" somewhere in the middle. I want to be able
to swap the words around to the other side of the "-". The lenght and
the amount of the words can vary.

e.g. if I have:-
apple banana - pear orange plum
wood metal glass - plastic

I want the result to be:-
pear orange plum - apple banana
plastic - wood metal glass

This must work on selected text only as only 3/4 of the document needs
changing, not the whole lot.
Mr Graham Mayor gave me following but it is not quite working. It is
only swapping around the words either side of the " - "

A wildcard replace of
([a-zA-Z]@)( - )([a-zA-Z]@)
with
\3\2\1
on the selected text should work.

So please can Graham or someone else help me out a bit further.

Your help is and always has been very much appreciated.
Thanking you in anticipation.



  #4   Report Post  
Posted to microsoft.public.word.docmanagement
Big Rick Big Rick is offline
external usenet poster
 
Posts: 7
Default Search and Replace help.

Absolutely, superb.
Thank you very much.
--
Big Rick


"Graham Mayor" wrote:

Assuming each line ends a paragraph, replace
([a-zA-Z ]@)( - )([a-zA-Z ]@)^13
with
\3\2\1^p
instead
--

Graham Mayor - Word MVP

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



Big Rick wrote:
Hello Folks
I have a document with many thousands of lines. All lines are 12 or
so words each with a "-" somewhere in the middle. I want to be able
to swap the words around to the other side of the "-". The lenght and
the amount of the words can vary.

e.g. if I have:-
apple banana - pear orange plum
wood metal glass - plastic

I want the result to be:-
pear orange plum - apple banana
plastic - wood metal glass

This must work on selected text only as only 3/4 of the document needs
changing, not the whole lot.
Mr Graham Mayor gave me following but it is not quite working. It is
only swapping around the words either side of the " - "

A wildcard replace of
([a-zA-Z]@)( - )([a-zA-Z]@)
with
\3\2\1
on the selected text should work.

So please can Graham or someone else help me out a bit further.

Your help is and always has been very much appreciated.
Thanking you in anticipation.




  #5   Report Post  
Posted to microsoft.public.word.docmanagement
Big Rick Big Rick is offline
external usenet poster
 
Posts: 7
Default Search and Replace help.

Absolutely superb. Thank you very much.
Your webite was a great help in tweaking it to include other characters.
--
Big Rick


"Graham Mayor" wrote:

Assuming each line ends a paragraph, replace
([a-zA-Z ]@)( - )([a-zA-Z ]@)^13
with
\3\2\1^p
instead
--

Graham Mayor - Word MVP

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



Big Rick wrote:
Hello Folks
I have a document with many thousands of lines. All lines are 12 or
so words each with a "-" somewhere in the middle. I want to be able
to swap the words around to the other side of the "-". The lenght and
the amount of the words can vary.

e.g. if I have:-
apple banana - pear orange plum
wood metal glass - plastic

I want the result to be:-
pear orange plum - apple banana
plastic - wood metal glass

This must work on selected text only as only 3/4 of the document needs
changing, not the whole lot.
Mr Graham Mayor gave me following but it is not quite working. It is
only swapping around the words either side of the " - "

A wildcard replace of
([a-zA-Z]@)( - )([a-zA-Z]@)
with
\3\2\1
on the selected text should work.

So please can Graham or someone else help me out a bit further.

Your help is and always has been very much appreciated.
Thanking you in anticipation.






  #6   Report Post  
Posted to microsoft.public.word.docmanagement
Graham Mayor Graham Mayor is offline
external usenet poster
 
Posts: 19,312
Default Search and Replace help.

You are welcome

--

Graham Mayor - Word MVP

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



Big Rick wrote:
Absolutely superb. Thank you very much.
Your webite was a great help in tweaking it to include other
characters.

Assuming each line ends a paragraph, replace
([a-zA-Z ]@)( - )([a-zA-Z ]@)^13
with
\3\2\1^p
instead
--

Graham Mayor - Word MVP

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



Big Rick wrote:
Hello Folks
I have a document with many thousands of lines. All lines are 12 or
so words each with a "-" somewhere in the middle. I want to be able
to swap the words around to the other side of the "-". The lenght
and the amount of the words can vary.

e.g. if I have:-
apple banana - pear orange plum
wood metal glass - plastic

I want the result to be:-
pear orange plum - apple banana
plastic - wood metal glass

This must work on selected text only as only 3/4 of the document
needs changing, not the whole lot.
Mr Graham Mayor gave me following but it is not quite working. It is
only swapping around the words either side of the " - "

A wildcard replace of
([a-zA-Z]@)( - )([a-zA-Z]@)
with
\3\2\1
on the selected text should work.

So please can Graham or someone else help me out a bit further.

Your help is and always has been very much appreciated.
Thanking you in anticipation.



Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
search and replace 1) and 2)...12) Brent Formatting Long Documents 2 July 4th 07 06:19 AM
Need some Search & Replace help scotteh New Users 17 January 24th 07 03:05 PM
Search & Replace LY Microsoft Word Help 4 April 8th 05 05:25 PM
Search and Replace Arne Microsoft Word Help 4 April 6th 05 11:05 PM
search and replace Tweedy Microsoft Word Help 1 February 10th 05 11:30 AM


All times are GMT +1. The time now is 01:15 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"