![]() |
#1
|
|||
|
|||
![]()
I'm trying to use wildcards in Find & Replace to reverse the order of names in a list from surname, first name e.g.
Blogs Fred --> Fred Blogs Smith John --> John Smith Doe John Etc SoForth I thought that I needed to select ‘Use wildcards’ & type \1 \2 in the ‘Find what’ field & \2 \1 in the ‘Replace with’ field, but when I do this & click ‘Replace All’ I get an error message: “The Replace with group text contains a number which is out of range” What's going on here? What am I doing wrong? ******************************* Edit: OK, I just tried (<*>) (<*>) in 'find what' & \2 \1 in 'replace with' & it works as long as I select the list of names first, otherwise it applies to everything in the document & messes up the text. I'm sure that I've done this in the past & it’s worked without me having to select text first, but I can’t remember how..............any suggestions? Also, I still don't understand why the first way didn't work & what the error message actually means, so any clarification still welcomed! TIA Last edited by jeffk; 11-10-2012 at 01:11 PM. Reason: additional info |
#2
|
|||
|
|||
![]()
The error is because you were trying to define groups 1 and 2 in the replace with field that were never defined in the find what field.
If each name in your list of names constitutes a single paragraph then you should have to select the text. Find: (<*>)( )(<*>)(^13) Replace With \3\2\1\4 |
#3
|
|||
|
|||
![]()
Thanks for that, but could you clarify some things in your answer? Actually, quite a lot of it!
Quote:
Quote:
Quote:
I know I'm asking a lot of questions there, so any that you feel like answering would be much appreciated. Alternatively, could you point me towards any good tutorials/resources on the topic? |
#4
|
|||
|
|||
![]()
1. Your understanding is correct.
2. The parens define the groups. Group 1 is the first <*>, group 2 is the space separating the words, group 3 it the second <*>, group 4 is the end of paragraph mark. This: If each name in your list of names constitutes a single paragraph then you should have to select the text. should have been: If each name in your list of names constitutes a single paragraph then you should "NOT" have to select the text. 1A. By adding the (^13) you will only process two word paragraphs (or only your list and not the rest of the text). Word 1 Space 2 Word 3 ParagraphMark 4 is rearranged: 3214 http://www.gmayor.com/replace_using_wildcards.htm |
![]() |
Tags |
find & replace, wildcards, word order |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
bthart | Word | 1 | 12-29-2011 12:45 AM |
![]() |
paulkaye | Word | 4 | 12-06-2011 11:05 PM |
![]() |
tinfanide | Word | 2 | 09-10-2011 10:40 AM |
Any wildcards search and replace in Powerpoint 2010? | tinfanide | PowerPoint | 0 | 09-10-2011 02:17 AM |
Reverse order of headings throughout Word | my_vine_figtree | Word VBA | 1 | 08-17-2010 01:46 AM |