Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
tammy tammy is offline
external usenet poster
 
Posts: 107
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Jay Freedman Jay Freedman is offline
external usenet poster
 
Posts: 9,854
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Jean-Guy Marcil[_2_] Jean-Guy Marcil[_2_] is offline
external usenet poster
 
Posts: 373
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
tammy tammy is offline
external usenet poster
 
Posts: 107
Default 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

Posting Rules

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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
parenthesis in equation editor ejkski Microsoft Word Help 2 March 6th 07 12:24 AM
quotation marks are turning into parenthesis new user Microsoft Word Help 1 October 12th 06 08:04 PM
How do i find and replace words in parenthesis? Bob in Arizona Microsoft Word Help 5 September 1st 06 06:31 AM
parenthesis c turns into copyright sign; bird lover Microsoft Word Help 2 August 7th 06 01:11 AM
Footnote reference mark in parenthesis Ian Microsoft Word Help 5 February 7th 05 04:59 PM


All times are GMT +1. The time now is 11:21 AM.

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"