globally change cross-reference style

Z

zapspan

In a particular Word document, my cross-references all appear in parens,
e.g., (1). I would like to globally remove the parens from all oft he
cross-references. Is there a way to do this?
 
H

Herb Tyson [MVP]

You can do it using Find and Replace:

Find what:([\(])([0-9]@)([\)])

Replace with:\2

Click the More>> button, and place a check next to Use Wildcards.

Why this works:

The find what expression groups numbers enclosed in parentheses into three
parts:

1. ( -- matched using ([\(])

2. the number -- matched using ([0-9]@), as [0-9]@ matches one or more
consecutive digits

3. ) -- matched using ([\)])

In the Replace with field, those three components can be referred to using
\1, \2, and \3. \1 will always be (, \3 will always be ), and \2 will always
be the number enclosed between ( and ).

Note: if those are the only numbers in parentheses, you can use Replace All.
Otherwise, you'll need to babysit the process to ensure that non-references
aren't also being changed.
 
Z

zapspan

Thank you very much for not only giving me the perfect solution but also
explaining how it works.

Herb Tyson said:
You can do it using Find and Replace:

Find what:([\(])([0-9]@)([\)])

Replace with:\2

Click the More>> button, and place a check next to Use Wildcards.

Why this works:

The find what expression groups numbers enclosed in parentheses into three
parts:

1. ( -- matched using ([\(])

2. the number -- matched using ([0-9]@), as [0-9]@ matches one or more
consecutive digits

3. ) -- matched using ([\)])

In the Replace with field, those three components can be referred to using
\1, \2, and \3. \1 will always be (, \3 will always be ), and \2 will always
be the number enclosed between ( and ).

Note: if those are the only numbers in parentheses, you can use Replace All.
Otherwise, you'll need to babysit the process to ensure that non-references
aren't also being changed.


--
Herb Tyson MS MVP
Author of the Word 2007 Bible
Blog: http://word2007bible.herbtyson.com
Web: http://www.herbtyson.com


zapspan said:
In a particular Word document, my cross-references all appear in parens,
e.g., (1). I would like to globally remove the parens from all oft he
cross-references. Is there a way to do this?
 
H

Herb Tyson [MVP]

Qapla'! (That's Klingon for "Success!", according to WikiPedia.)

Glad to help.

Word's wildcard syntax is only slightly harder to understand than Klingon.
;-)

--
Herb Tyson MS MVP
Author of the Word 2007 Bible
Blog: http://word2007bible.herbtyson.com
Web: http://www.herbtyson.com


zapspan said:
Thank you very much for not only giving me the perfect solution but also
explaining how it works.

Herb Tyson said:
You can do it using Find and Replace:

Find what:([\(])([0-9]@)([\)])

Replace with:\2

Click the More>> button, and place a check next to Use Wildcards.

Why this works:

The find what expression groups numbers enclosed in parentheses into
three
parts:

1. ( -- matched using ([\(])

2. the number -- matched using ([0-9]@), as [0-9]@ matches one or more
consecutive digits

3. ) -- matched using ([\)])

In the Replace with field, those three components can be referred to
using
\1, \2, and \3. \1 will always be (, \3 will always be ), and \2 will
always
be the number enclosed between ( and ).

Note: if those are the only numbers in parentheses, you can use Replace
All.
Otherwise, you'll need to babysit the process to ensure that
non-references
aren't also being changed.


--
Herb Tyson MS MVP
Author of the Word 2007 Bible
Blog: http://word2007bible.herbtyson.com
Web: http://www.herbtyson.com


zapspan said:
In a particular Word document, my cross-references all appear in
parens,
e.g., (1). I would like to globally remove the parens from all oft he
cross-references. Is there a way to do this?
 
Top