Re: Find & Replace Question

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Mary (anonymous_at_discussions.microsoft.com)
Date: 05/06/04


Date: Thu, 6 May 2004 08:34:40 -0700

Your statement "That extra character remains part of the
search string, but you want to keep that character, so
you mark it with round brackets to enable you to put back
the extra leading character in your replacement" was what
I needed to hear and it hit the spot. I'm gonna make you
proud yet!

Thanks so very much, Graham.

Your grateful Ft. Lauderdale fan,
Mary

>-----Original Message-----
>The principle of searching is to look for a unique
string.
>Here you are looking for two spaces but not if those two
spaces follow a
>full stop (period)
>Essentially the [!.] means look for any character except
a full stop
>(period). i.e. the exclamation mark means ignore this
(or these)
>character(s) in this bracketed section. Thus you can
exclude characters from
>the search string.
>That extra character remains part of the search string,
but you want to keep
>that character, so you mark it with round brackets
>to enable you to put back the extra leading character in
your replacement
>string using the \1 , which means replace the first set
of bracketed
>characters.
>
>--
><>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
> Graham Mayor - Word MVP
>
> Web site www.gmayor.com
> Word MVP web site www.mvps.org/word
><>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
>
>
>
>Mary wrote:
>> Graham, thanks more than I can say for your additional
>> input. I feel so stupid each time I let the
exclamation
>> point in a string throw me, but it never fails to do
so.
>>
>> I'm still not the sharpest tool in the shed when it
comes
>> to find and replace, but I'm a million times better
since
>> reading the wonderful article by you and Jay. I'll
keep
>> trying to better understand the ! .
>>
>> Thanks again!
>>
>>
>>> -----Original Message-----
>>> Jay Freedman wrote:
>>>> I assume that when you find two spaces between
words, you then want
>>>> to replace them with a single space. To do that,
modify the Find
>>>> What expression to
>>>>
>>>> ([!.])<space><space>
>>>>
>>>> and use the Replace With expression
>>>>
>>>> \1<space>
>>>>
>>>> The \1 part will be filled in with whatever
character matched the
>>>> [!1], and the two spaces will be replaced with one
space.
>>>
>>> Or ..... you could move the bracket
>>> ([!.]<space>)<space>
>>> and replace with
>>> \1
>>>
>>> Or...... if you may have more than two spaces
>>> you could search for
>>> ([!.]<space>)<space>{1,}
>>>
>>> Personally I like to square bracket spaces so they
are not missed -
>>> but the square brackets are not necessary to make the
search string
>>> work.
>>>
>>> ([!.][ ])[ ]{1,}
>>> and replace with
>>> \1
>>>
>>> --
>>> <>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
>>> Graham Mayor - Word MVP
>>>
>>> Web site www.gmayor.com
>>> Word MVP web site www.mvps.org/word
>>> <>>< ><<> ><<> <>>< ><<> <>>< <>>< ><<>
>>>
>>>
>>>
>>> .
>
>
>.
>



Relevant Pages

  • Re: Searching by Unicode codes
    ... What character are you searching for? ... What is its hex number? ... search string ^U0xnnnn, for example - no luck there, and similarly no luck ... Are there any other settings ...
    (microsoft.public.word.application.errors)
  • Re: [Dialog] Cracking Richard
    ... in the database, ... Some people use special formats for sigs or even set sigs to be ... I can see in the hex editor that the control character that precedes ... search string contains regular expressions ...
    (news.software.readers)
  • Re: Find/Replace in TStringList loses lots of data
    ... Nth file character (where N is the search string length) against all ... If it is in the search string it jumps ... Basically one sets up a 256 character array of byte values, ...
    (comp.lang.pascal.delphi.misc)
  • Re: how do I get word and paragraph based on character position?
    ... And what do you mean it contains the character 2043. ... expands the Selection to the paragraph. ... sets a string variable to use as the search string - less the paragraph ... Once I found this occurence I will link ...
    (microsoft.public.word.vba.beginners)
  • Re: Why tuple with one item is no tuple
    ... Complaints about typing an extra character are not all the same. ... >> no way to have both operators in a natural way in python. ... > have mutable keys for dicts that needed copying the very same keys - at ...
    (comp.lang.python)