[bksvol-discuss] For Sue - how to use find and replace to get rid of double dashes around page numbers

Hi Sue,

Just saw that you had the same problem as Lori, but with a different character around the page numbers. Smile. So I'll give you the same instructions I just posted for Lori, but customized for two dashes (i.e. two hyphens).

I'm going to give you instructions on how to do this two different ways.

The first way works if there aren't any spaces between the hyphens and the numbers. The second way works if you do have any number of spaces before and or after the hyphens and your page number.

It's going to seem like magic numbers if you aren't a programmer who uses what are called "regular expressions" and wild cards, but it can be done. smile. So here's my instructions.

Before you do anything, save a copy of the file just in case, so you don't lose any of your previous work on the book.

How to do Way One. Use this way if you don't have any spaces between the hyphens and the numbers.

You use a special kind of search, using the "use wildcards" box in the find and replace dialogue.

In the Find and Replace dialogue box, click on the button that is marked "More." This will expand the options that are available in the Find and Replace box to include a new list of Search Options. In the list of Search Options, check the box for "use wildcards" (you can also do this while in the Search box by typing alt U, which is alt "capital U)

Next, in the find box, enter the following exact string:

\--([0-9]@)\--

that is, back-slash hyphen hyphen left-parentheses left-square-bracket zero hyphen nine right-square-bracket at-sign right-parentheses back-slash hyphen hyphen

In the replace box, enter the following exact string:
\1

that is backslash numeral-one

You can then execute a "replace all" or if you want to be safer (until you are sure this is working exactly right), instead execute a find and as it finds each page number in parentheses that you want to fix execute a replace each time.

Here's how to do Way Two, which will find every page number and strip the parentheses even if there are spaces in front of and-or behind the page numbers.

You use a special kind of search four times, using the "use wildcards" box in the find and replace dialogue.

In the Find and Replace dialogue box, click on the button that is marked "More." This will expand the options that are available in the Find and Replace box to include a new list of Search Options. In the list of Search Options, check the box for "use wildcards" (you can also do this while in the Search box by typing alt U, which is alt "capital U)

Next, in the find box, enter the following exact string to do search one:

\--([0-9]@)\--

that is, back-slash hyphen hyphen left-parentheses left-square-bracket zero hyphen nine right-square-bracket at-sign right-parentheses back-slash hyphen hyphen

In the replace box, enter the following exact string:
\1

that is backslash numeral-one

You can then execute a "replace all" or if you want to be safer (until you are sure this is working exactly right), instead execute a find and as it finds each page number in parentheses that you want to fix, execute a replace.


Next, in the find box, enter the following exact string to do search two:

\-- @([0-9]@)\--

that is, back-slash hyphen hyphen space at-sign left-parentheses left-square-bracket zero hyphen nine right-square-bracket at-sign right-parentheses back-slash hyphen hyphen

In the replace box, enter the following exact string:
\1

that is backslash numeral-one

You can then execute a "replace all" or if you want to be safer (until you are sure this is working exactly right), instead execute a find and as it finds each page number in parentheses that you want to fix, execute a replace.

Next, in the find box, enter the following exact string to do search three:

\--([0-9]@) @\--

that is, back-slash hyphen hyphen left-parentheses left-square-bracket zero hyphen nine right-square-bracket at-sign right-parentheses space at-sign back-slash hyphen hyphen

In the replace box, enter the following exact string:
\1

that is backslash numeral-one

You can then execute a "replace all" or if you want to be safer (until you are sure this is working exactly right), instead execute a find and as it finds each page number in parentheses that you want to fix, execute a replace.

Next, in the find box, enter the following exact string to do search four:

\-- @([0-9]@) @\--

that is, back-slash hyphen hyphen space at-sign left-parentheses left-square-bracket zero hyphen nine right-square-bracket at-sign right-parentheses space at-sign back-slash hyphen hyphen

In the replace box, enter the following exact string:
\1

that is backslash numeral-one

You can then execute a "replace all" or if you want to be safer (until you are sure this is working exactly right), instead execute a find and as it finds each page number in parentheses that you want to fix, execute a replace.

That's it!!

Good luck.  smile.

Judy s.

siss52 wrote:
Hi Lori,

I am wondering the same thing. The book I am working on has dashes, (double hyphens) around page numbers and it is tedious getting rid of the dashes by hand.

Sue S.

To unsubscribe from this list send a blank Email to
bksvol-discuss-request@xxxxxxxxxxxxx
put the word 'unsubscribe' by itself in the subject line.  To get a list of 
available commands, put the word 'help' by itself in the subject line.

Other related posts: