Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Find and remove parenthesis
Hello,
I have years listed in a document as: (2007) and would like to remove all of the parenthesis surrounding the year. So, the year should then display as: 2007 There are possibly hundreds of these to change, so I'm looking for an easy way of doing this. I know I can have the Find and Replace dialog box find the open parenthesis, and replace it with nothing. Then, I can run through the same process for all closing parentheses. But, again, this could take a long time, as there may be hundreds of parentheses. There is other text within the document that is enclosed within parentheses, and I do not want it included in the find. I've also tried working with the wildcard option. I found the year surrounded by parens by typing: \(????\) However, I can't figure out what to put in the Replace field. I want to replace with just the numbers. I'm using Word 2007. Any suggestions? Thank you! |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Find and remove parenthesis
On Wed, 23 Apr 2008 09:05:18 -0700, Tammy
wrote: Hello, I have years listed in a document as: (2007) and would like to remove all of the parenthesis surrounding the year. So, the year should then display as: 2007 There are possibly hundreds of these to change, so I'm looking for an easy way of doing this. I know I can have the Find and Replace dialog box find the open parenthesis, and replace it with nothing. Then, I can run through the same process for all closing parentheses. But, again, this could take a long time, as there may be hundreds of parentheses. There is other text within the document that is enclosed within parentheses, and I do not want it included in the find. I've also tried working with the wildcard option. I found the year surrounded by parens by typing: \(????\) However, I can't figure out what to put in the Replace field. I want to replace with just the numbers. I'm using Word 2007. Any suggestions? Thank you! You're on the right track with the wildcard replacement. You now need to add some things to it to preserve the numbers. In a wildcard search expression you can enclose things in parentheses _without_ the backslashes to indicate a group: \((????)\) Then the replace expression can refer to that group as \1 If you had more groups in the search expression, they would be \2, \3 and so on. This is explained in more detail at http://www.gmayor.com/replace_using_wildcards.htm. -- Regards, Jay Freedman Microsoft Word MVP FAQ: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. |
#3
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Find and remove parenthesis
"Tammy" wrote:
Hello, I have years listed in a document as: (2007) and would like to remove all of the parenthesis surrounding the year. So, the year should then display as: 2007 There are possibly hundreds of these to change, so I'm looking for an easy way of doing this. I know I can have the Find and Replace dialog box find the open parenthesis, and replace it with nothing. Then, I can run through the same process for all closing parentheses. But, again, this could take a long time, as there may be hundreds of parentheses. There is other text within the document that is enclosed within parentheses, and I do not want it included in the find. I've also tried working with the wildcard option. I found the year surrounded by parens by typing: \(????\) However, I can't figure out what to put in the Replace field. I want to replace with just the numbers. Almost there...! In the "Find what" part, use: \((????)\) In "Replace with" use: \1 "\1" tells Word to keep intact whatever is in between the first set of ( ) in the "Find what" part. You could have many sets of ( ). Each set would be numbered in the order they appear \1 \2 \3. You can use that to switch strings of text around [Find (Bo???)( Smit???) and Replace with \2\1, etc.], delete only certain parts [Find (Bo???)( Smit???) and Replace with \2, etc.], etc... In your case, since the the ( ) in the text are not part of the ( ) in the code expression in the "Find what" part, they will be deleted. "\(" tells Word that the "(" following the "\" is an actual "(", not a opening parenthesis for a string of text used as a wild card code, like the second "(" in the expression. |
#4
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Find and remove parenthesis
Hi Jean-Guy,
Thank you so much for the solution and the explanation! It works perfectly! I truly appreciate you responding to my post! Have a great day! "Jean-Guy Marcil" wrote: "Tammy" wrote: Hello, I have years listed in a document as: (2007) and would like to remove all of the parenthesis surrounding the year. So, the year should then display as: 2007 There are possibly hundreds of these to change, so I'm looking for an easy way of doing this. I know I can have the Find and Replace dialog box find the open parenthesis, and replace it with nothing. Then, I can run through the same process for all closing parentheses. But, again, this could take a long time, as there may be hundreds of parentheses. There is other text within the document that is enclosed within parentheses, and I do not want it included in the find. I've also tried working with the wildcard option. I found the year surrounded by parens by typing: \(????\) However, I can't figure out what to put in the Replace field. I want to replace with just the numbers. Almost there...! In the "Find what" part, use: \((????)\) In "Replace with" use: \1 "\1" tells Word to keep intact whatever is in between the first set of ( ) in the "Find what" part. You could have many sets of ( ). Each set would be numbered in the order they appear \1 \2 \3. You can use that to switch strings of text around [Find (Bo???)( Smit???) and Replace with \2\1, etc.], delete only certain parts [Find (Bo???)( Smit???) and Replace with \2, etc.], etc... In your case, since the the ( ) in the text are not part of the ( ) in the code expression in the "Find what" part, they will be deleted. "\(" tells Word that the "(" following the "\" is an actual "(", not a opening parenthesis for a string of text used as a wild card code, like the second "(" in the expression. |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
parenthesis in equation editor | Microsoft Word Help | |||
quotation marks are turning into parenthesis | Microsoft Word Help | |||
How do i find and replace words in parenthesis? | Microsoft Word Help | |||
parenthesis c turns into copyright sign; | Microsoft Word Help | |||
Footnote reference mark in parenthesis | Microsoft Word Help |