#1
|
|||
|
|||
search and replace a field containing text and numbers
Hi
I have a field that contains text and numbers e.g. abc123 I wish to search for this field and replace the contents with 'abc123' the numeric part may be 1, 2, 3, or 4 digits can this be done? Bob M |
#2
|
|||
|
|||
I do not believe this can be done using search and replace. It could be done with a macro that finds and examines fields. Those that have a value matching your criteria should be unlinked (converted to their values).
At least that is how I would approach it. |
#3
|
||||
|
||||
What kind of field? Charles' reply concerns fields created via field codes, such as formfields, cross-references, tables of contents, hyperlinks, etc., but perhaps that's not what you mean.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#4
|
|||
|
|||
The field is formatted as general in excel where the data is inputted.
The spreadsheet is then saved as a .csv file and opened in word Here I do some search and replace work - mostly adding quote marks around various nominal fields Bob M |
#5
|
||||
|
||||
So, what you're calling fields has nothing to do with Word's field codes. Rather, you seem to be referring to what in Excel would have been separate columns, but is now just text with commas separating the different elements.
In that case a wildcard Find/Replace can do what you're after, where: Find = <abc[0-9]{1,4}> Replace = abc123
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#6
|
|||
|
|||
Hi Paul
I understand your suggested find but NOT the replace I wish to take abc123 and create 'abc123' or take def4032 and create 'def4032' Bob M |
#7
|
||||
|
||||
Your original post suggested to me that you wanted to replace abc followed by any number with abc123.
If you want to replace any multi-letter sequence that precedes a multi-digit sequence, you could use: Find = <[A-Za-z]{1,}[0-9]{1,}> Replace = '^&' to insert the single-quote characters either side
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Macro to find text and replace with form field containing that text | iiiiifffff | Word VBA | 16 | 06-04-2016 01:47 AM |
how to search and replace BOLD text >> font color change? | dylansmith | Word | 4 | 03-12-2013 09:51 PM |
Replace all occurrences of one merge field with plain text | blankenthorst | Mail Merge | 5 | 07-01-2011 05:18 AM |
Find and replace page numbers in body of text | tollanarama | Word | 3 | 02-13-2011 06:00 AM |
Search and Replace - Clear Search box | JostClan | Word | 1 | 05-04-2010 08:46 PM |