Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
msnyc07 msnyc07 is offline
external usenet poster
 
Posts: 12
Default Selective Replace in Search and Replace

I need to search and replace in a large document. I don't want to replace the
entire search term/expression just part of it. In this case I am searching
for a paragraph return followed by any letter (not digit) and then want to
change that to paragraph/tab but keep the letter. The search looks like this

^p^$

but naturally if replace is



^p^t

I lose the first letter of the text string which I don't want

How can I construct either search and replace so that



^p

Alexander

turns into

^p

^tAlexander

and not

^p

^tlexander



Thanks in advance!
  #2   Report Post  
Posted to microsoft.public.word.docmanagement
Jay Freedman Jay Freedman is offline
external usenet poster
 
Posts: 9,854
Default Selective Replace in Search and Replace

You can use a wildcard replacement
(http://www.gmayor.com/replace_using_wildcards.htm).

Use the search term

([^13])([A-Za-z])

and the replacement term

\1^t\2


However, if what you're trying to achieve is an indent at the start of
each paragraph, then don't do it by adding a tab. Instead, modify the
paragraph style to include a first-line indent.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

On Thu, 24 Dec 2009 08:55:01 -0800, msnyc07
wrote:

I need to search and replace in a large document. I don't want to replace the
entire search term/expression just part of it. In this case I am searching
for a paragraph return followed by any letter (not digit) and then want to
change that to paragraph/tab but keep the letter. The search looks like this

^p^$

but naturally if replace is



^p^t

I lose the first letter of the text string which I don't want

How can I construct either search and replace so that



^p

Alexander

turns into

^p

^tAlexander

and not

^p

^tlexander



Thanks in advance!

  #3   Report Post  
Posted to microsoft.public.word.docmanagement
msnyc07 msnyc07 is offline
external usenet poster
 
Posts: 12
Default Selective Replace in Search and Replace

Awesome and perfect thank you. Now I understand the concept as well

I do need the tab, I was trying to export to Excel as a two column sheet but
a few of my several thousand items did not have product #s before them and I
didn't want them to inadvertently end up AS product #s.

Thanks again!!!

"Jay Freedman" wrote:

You can use a wildcard replacement
(http://www.gmayor.com/replace_using_wildcards.htm).

Use the search term

([^13])([A-Za-z])

and the replacement term

\1^t\2


However, if what you're trying to achieve is an indent at the start of
each paragraph, then don't do it by adding a tab. Instead, modify the
paragraph style to include a first-line indent.

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

On Thu, 24 Dec 2009 08:55:01 -0800, msnyc07
wrote:

I need to search and replace in a large document. I don't want to replace the
entire search term/expression just part of it. In this case I am searching
for a paragraph return followed by any letter (not digit) and then want to
change that to paragraph/tab but keep the letter. The search looks like this

^p^$

but naturally if replace is



^p^t

I lose the first letter of the text string which I don't want

How can I construct either search and replace so that



^p

Alexander

turns into

^p

^tAlexander

and not

^p

^tlexander



Thanks in advance!

.

  #4   Report Post  
Posted to microsoft.public.word.docmanagement
msnyc07 msnyc07 is offline
external usenet poster
 
Posts: 12
Default Selective Replace in Search and Replace

FYI that concept came in handy immediately.

A large # of the records I imported into the word doc initially it turns out
for some reason didn't parse a Return so I ended up with

Record1Record2

instead of

Record1
Record2

So I did

([a-z])([A-Z])
\1^p\2

and solved it in 10 seconds vs the hours of frustration I'd have ordinarily
faced.

Thanks!

"msnyc07" wrote:

I need to search and replace in a large document. I don't want to replace the
entire search term/expression just part of it. In this case I am searching
for a paragraph return followed by any letter (not digit) and then want to
change that to paragraph/tab but keep the letter. The search looks like this

^p^$

but naturally if replace is



^p^t

I lose the first letter of the text string which I don't want

How can I construct either search and replace so that



^p

Alexander

turns into

^p

^tAlexander

and not

^p

^tlexander



Thanks in advance!

Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Search and Insert, Search and Replace, Modify Document Margins instant000 Formatting Long Documents 2 October 26th 09 09:34 PM
Need some Search & Replace help scotteh New Users 17 January 24th 07 03:05 PM
Search and replace jldube Microsoft Word Help 5 May 5th 06 03:45 PM
Search and Replace Jackie Formatting Long Documents 0 October 20th 05 10:23 AM
Search and Replace Jackie Formatting Long Documents 0 October 20th 05 10:23 AM


All times are GMT +1. The time now is 11:34 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"