Author | Thread |
|
03/07/2011 02:02:35 PM · #1 |
If I have a text that has numbers in it, is there a simple way to find all examples of the text and insert a letter before?
Let's say I have the numbers 1-25 and I want to replace them with A1, A2, A3, A4...
Currently I am using search and replace, but it's a bit clunky. Using wildcards I search for "<1" (a 1 at the beginning of a word so as not to find the second 1 in 11) and replace it with "A1". Then I do "<2" and replace with "A2" on down the line until I finish with "<9" and replace with "A9". The problem is I have about 30-50 documents to do this to.
I'm wondering if there is a more efficient way where I can essentially tell Word to search for the beginning of the number and insert the letter before no matter whether the first number is 1-9? Luckily the numbers in the text have a special font so I can distinguish them from the words in the text by searching based on font.
Any Word gurus? |
|
|
03/07/2011 02:19:40 PM · #2 |
I'm not a Word guru by any means, so maybe this is silly. But have you looked creating a Macro to run through the possibilities for you? If you are using Word 2007, you must enable the Developer menu in the options to get to Macros. |
|
|
03/07/2011 02:26:26 PM · #3 |
you could record a macro and then edit it. |
|
|
03/07/2011 02:30:24 PM · #4 |
Ya, I think I was aware of that, although I have no macro experience so I was hoping there was a non-macro way. |
|
|
03/07/2011 02:54:54 PM · #5 |
You can use regular expressions in Word, I don't know if it will do exactly what you want as I've never used it myself, but you can check here to find out:
//office.microsoft.com/en-us/support/add-power-to-word-searches-with-regular-expressions-HA001087305.aspx |
|
|
03/07/2011 03:22:29 PM · #6 |
Originally posted by Covert_Oddity: You can use regular expressions in Word... | Yes, although Word usually makes me make a highly irregular expression :-P
The key is in the link in Covert_Oddity's post; use the form [0-9] to limit the search to numeric characters. You may need to experiment a little to get the result you want, but you can certainly get there. |
|
|
03/07/2011 06:29:04 PM · #7 |
<[1-9] ought to find all instances of a number starting a line...
R.
ETA: I guess Kirbic already said this, more or less. I'm no expert at word searches but I do edit manuscripts, some of which are scholarly, and I do have to be able to find my way around.
R.
Message edited by author 2011-03-07 18:30:13. |
|
|
03/07/2011 06:42:06 PM · #8 |
For this kind of stuff, you should look into a good text editor. I use TextPad. It's a free download, but I bought it years ago. |
|
|
03/07/2011 06:54:42 PM · #9 |
Originally posted by Bear_Music: <[1-9] ought to find all instances of a number starting a line...
R.
ETA: I guess Kirbic already said this, more or less. I'm no expert at word searches but I do edit manuscripts, some of which are scholarly, and I do have to be able to find my way around.
R. |
You were close. I used <([1-9]) so that I could replace with A\1 where the "1" signifies the string between the (). It worked quite well and it's shortening my workload by quite a bit.
Thanks everybody for the help! |
|
|
03/07/2011 08:19:37 PM · #10 |
Originally posted by bvy: For this kind of stuff, you should look into a good text editor. I use TextPad. It's a free download, but I bought it years ago. |
It's kind of hard to edit Word documents in a plaintext editor.
|
|
|
03/07/2011 08:26:21 PM · #11 |
Originally posted by alohadave: Originally posted by bvy: For this kind of stuff, you should look into a good text editor. I use TextPad. It's a free download, but I bought it years ago. |
It's kind of hard to edit Word documents in a plaintext editor. |
I do it all the time.
ETA: My point was this: If you find yourself doing this kind of heavy lifting regularly, you're better off with a good text editor. Obviously, if you have a Word document with all sorts of formatting already applied, this won't help you. But if you just have paragraphs of text, long lists, or whatever -- with little or no formatting applied -- it's easier to copy the text into a good text editor, do what you need to do, then copy and paste it back into Word. TextPad is good because it has good, robust support for regular expressions and such. It's just a good tool to know about.
Message edited by author 2011-03-07 22:00:49. |
|
Home -
Challenges -
Community -
League -
Photos -
Cameras -
Lenses -
Learn -
Help -
Terms of Use -
Privacy -
Top ^
DPChallenge, and website content and design, Copyright © 2001-2025 Challenging Technologies, LLC.
All digital photo copyrights belong to the photographers and may not be used without permission.
Current Server Time: 08/20/2025 11:58:55 PM EDT.