Wildcard and placeholders

A

AzmL

Hi there

I am doing a find and replace exercise using wildcards
I have MS Office Professional 2010

I want to replace "Section X" by "Chapter X" (X being a number from 0 t
9

Here is what I have inputed into the Find and Replace box
Find what: Section ([0-9])
Replace with: Chapter \1

Curiously, "Section X" is replaced by "X Chapter" (the number appear
BEFORE Chapter)
Is this a bug? I have been using wildcard several times and never face
such a behaviour

Many thank
 
S

Stefan Blom

Try the following instead:

"Find what": (Section )([0-9])

"Replace with": (Chapter )\2
 
S

Stefan Blom

Sorry, I made a typo. "Replace with" should be:

Chapter \2

(note that there is a space before the backslash).

--
Stefan Blom
Microsoft Word MVP




Stefan Blom said:
Try the following instead:

"Find what": (Section )([0-9])

"Replace with": (Chapter )\2

--
Stefan Blom
Microsoft Word MVP




AzmL said:
Hi there,

I am doing a find and replace exercise using wildcards.
I have MS Office Professional 2010.

I want to replace "Section X" by "Chapter X" (X being a number from 0 to
9)

Here is what I have inputed into the Find and Replace box:
Find what: Section ([0-9])
Replace with: Chapter \1

Curiously, "Section X" is replaced by "X Chapter" (the number appears
BEFORE Chapter).
Is this a bug? I have been using wildcard several times and never faced
such a behaviour.

Many thanks
 
A

AzmL

Hi Stefan,

Thank you for your help.

Unfortunately I still get the same bug.


I have also tried the following, just to try understanding what is goin
on:


Find What: TXT ([0-9]{1,})
Replace with: helloword \1

Original text: TXT 156
Replaced text: hell156oword

Also, it does not pick up all the TXT ### instances (### are 3 digits)
All of this looks extremely random I am very confused
 
S

Stefan Blom

Sorry, wildcard searches are tricky. :-(

"Find what": (Section )([0-9]{1,})

"Replace with": Chapter \2

Note that {1, } is for English systems. If your list separator (in Control
Panel) is a semi-colon, use that instead.

This should match all occurrences of Section, followed by a space, followed
by a number with one digit or more, and the replacement is Chapter followed
by a space followed by the found number.

Remember to select "Use wildcards" in the Find and Replace dialog box.

Note that I'm assuming here that the text and the numbers were typed in. If
auto numbering has been used, the find and replace will fail.
 
S

Suzanne S. Barnhill

Assuming that you have used a specific style for your section/chapter
headings, just search for "Section" and replace with "Chapter." With the
insertion point in the "Find what" box, click More to expand the Replace
dialog. Check the box for "Match case," and then click Format and choose
Style. Select the style used for your headings, and click OK. Replace All.
If you had used auto numbering for these headings, you would only have to
modify the number format in the Multilevel List dialog.

"AzmL" wrote in message

Hi there,

I am doing a find and replace exercise using wildcards.
I have MS Office Professional 2010.

I want to replace "Section X" by "Chapter X" (X being a number from 0 to
9)

Here is what I have inputed into the Find and Replace box:
Find what: Section ([0-9])
Replace with: Chapter \1

Curiously, "Section X" is replaced by "X Chapter" (the number appears
BEFORE Chapter).
Is this a bug? I have been using wildcard several times and never faced
such a behaviour.

Many thanks
 
S

Stefan Blom

Suzanne S. Barnhill said:
Assuming that you have used a specific style for your section/chapter
headings, just search for "Section" and replace with "Chapter." With the
insertion point in the "Find what" box, click More to expand the Replace
dialog. Check the box for "Match case," and then click Format and choose
Style. Select the style used for your headings, and click OK. Replace All.

I have to admit I'm a bit embarrassed, for not thinking of the most obvious
way to do this...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top