Replacing bracketed text

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi All,

I'm trying to figure out a way in Word 2003 to search for a string of
numbers inside brackets.

Let's say I've got... [12345], [ 2345 ] or even [ 123 345 ]

What I want to do is use the replace feature to reduce any of those to [ ].
I don't care what is between the brackets, I want it to be replaced with a
single space.

I have tried various combinations of ascii codes and wildcards, but I can
not get it to work. The best I've gotten is []2345[].

The asterix does not seem to like this: ^091*^093.

I thought this was going to be simple... boy was I wrong.
 
That seems to work perfectly, but only for the first instance. I tinkered a
bit with yours and came up with \[?[0-9]@?\] that seems to match all but the
third, and I don't think I'll need to-- thanks much!

Greg Maxey said:
Search for:
\[[0-9]@\]
with Use Wildcards selected.

--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.

Hi All,

I'm trying to figure out a way in Word 2003 to search for a string of
numbers inside brackets.

Let's say I've got... [12345], [ 2345 ] or even [ 123 345 ]

What I want to do is use the replace feature to reduce any of those
to [ ]. I don't care what is between the brackets, I want it to be
replaced with a single space.

I have tried various combinations of ascii codes and wildcards, but I
can not get it to work. The best I've gotten is []2345[].

The asterix does not seem to like this: ^091*^093.

I thought this was going to be simple... boy was I wrong.
 
Wow, thank you for all the effort... Greg gave me a great headstart, thanks
anyway.

Graham Mayor said:
See http://www.gmayor.com/replace_using_wildcards.htm

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Hi All,

I'm trying to figure out a way in Word 2003 to search for a string of
numbers inside brackets.

Let's say I've got... [12345], [ 2345 ] or even [ 123 345 ]

What I want to do is use the replace feature to reduce any of those
to [ ]. I don't care what is between the brackets, I want it to be
replaced with a single space.

I have tried various combinations of ascii codes and wildcards, but I
can not get it to work. The best I've gotten is []2345[].

The asterix does not seem to like this: ^091*^093.

I thought this was going to be simple... boy was I wrong.
 
\[[0-9 ]{1,}\]

will find all your examples - note the space after the 9

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

That seems to work perfectly, but only for the first instance. I
tinkered a bit with yours and came up with \[?[0-9]@?\] that seems to
match all but the third, and I don't think I'll need to-- thanks much!

Greg Maxey said:
Search for:
\[[0-9]@\]
with Use Wildcards selected.

--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.

Hi All,

I'm trying to figure out a way in Word 2003 to search for a string
of numbers inside brackets.

Let's say I've got... [12345], [ 2345 ] or even [ 123 345 ]

What I want to do is use the replace feature to reduce any of those
to [ ]. I don't care what is between the brackets, I want it to be
replaced with a single space.

I have tried various combinations of ascii codes and wildcards, but
I can not get it to work. The best I've gotten is []2345[].

The asterix does not seem to like this: ^091*^093.

I thought this was going to be simple... boy was I wrong.
 
Thanks!

Graham Mayor said:
\[[0-9 ]{1,}\]

will find all your examples - note the space after the 9

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>

That seems to work perfectly, but only for the first instance. I
tinkered a bit with yours and came up with \[?[0-9]@?\] that seems to
match all but the third, and I don't think I'll need to-- thanks much!

Greg Maxey said:
Search for:
\[[0-9]@\]
with Use Wildcards selected.

--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.


Alex wrote:
Hi All,

I'm trying to figure out a way in Word 2003 to search for a string
of numbers inside brackets.

Let's say I've got... [12345], [ 2345 ] or even [ 123 345 ]

What I want to do is use the replace feature to reduce any of those
to [ ]. I don't care what is between the brackets, I want it to be
replaced with a single space.

I have tried various combinations of ascii codes and wildcards, but
I can not get it to work. The best I've gotten is []2345[].

The asterix does not seem to like this: ^091*^093.

I thought this was going to be simple... boy was I wrong.
 

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

Back
Top