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!
0
Utf
12/24/2009 4:55:01 PM
word.docmanagement 5542 articles. 2 followers. Follow

3 Replies
1013 Views

Similar Articles

[PageSpeed] 51

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
<msnyc07@discussions.microsoft.com> 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!
0
Jay
12/24/2009 5:29:08 PM
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
> <msnyc07@discussions.microsoft.com> 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!
> .
> 
0
Utf
12/24/2009 6:32:01 PM
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!
0
Utf
12/24/2009 6:58:03 PM
Reply:

Similar Artilces:

Run report on multi selected records.
I try to make a report for a custom entity that works like the Account Summary: let's say that it's Customer's Inquiry Summary for entity Customer's Inquiry I made the report so that I'm able to run the report on Customer's Inquiry Form. But when I select multi records in the list of Customer's Inquiry and run report, only one record is show in one page of the the report. I would like to have the selected records appear in the report with each record on each page. How can I do this? ...

Combo box list selection based on earlier selection by user
HI, I have a form that has a combo box 1 (Product) that reads a the Product table and has a unique id attached to each product (RO#). There is a second combo box 2 that is RO#. Now what I would like to do is when a user selects a Product in combo box 1, the system should lookup the Product selected from combo box 1 and upload the corresponding RO# in the combo box 2 list. Now I am using both combo boxes as Unbound and in the combo box 2 I have the two columns Product and RO# - in the Criteria row of RO# I have the following: Like IIf([Forms]![xa_f_lookup]![RO#]=" ",[Forms]![x...

Fast way to search many cells by column for text strings
Am looking for quick way to search for and list, a specified, given text string in all cells in a column, e.g. look for text string " E/G " Assume the target col is col A, data from row2 Put in B2: =ISNUMBER(FIND("E/G",A2)) Put in C2: =ISNUMBER(SEARCH("E/G",A2)) (FIND is case sensitive, SEARCH is not case sensitive) Select B2:C2 and fill down Put a label into B1:C1, then do an autofilter in B1 (or in C1) to filter out the rows with: TRUE, depending on whether search is to be case sensitive or not. -- Rgds Max xl 97 --- GMT+8, 1� 22' N 103� 45' E xd...

Can't select objects in Excel 2007
I'm trying to create a form in Excel 2007, and although I can manipulate, copy & paste controls (check boxes, etc) I can't select multiple objects to align them, etc. I've checked on-line help (and have followed the instructions), and other websites, but no one seems to have indicated a problem. It is extremely cumbersome and I need a solution. Any ideas? Thanks in advance, Jim Berglund I know this is about a year too late, but it may help others who have stumbled across this page looking for similar help. On the Home tab, in the Editing group, click Find & Select....

Lot Selection not Showing when I select PO on Receiving Entry
Usually, the Lot selection screen would pop up when I select a PO at the Line Detail of the Receivings Entry, now it does not! And GP will let items post without a lot number! It seems as if a setting has changed. Any ideas anyone? Any help is appreciated. Thanks, R Are you sure the item is marked to track lots? This wiould be set item by item on the Item Maintenance Options window. -- Richard L. Whaley Author / Consultant / MVP 2006-2008 Documentation for Software Users Get our Free Tips and Tricks Newsletter and check out our books at http://www.AccoladePublications.com &q...

Searching (and replacing) tabs
I have spreadsheets (provided by clients) that contain tab characters. How can I search for and replace these? Phil Hibbs. try Sub DeleteTabCharacters() Cells.Replace What:="Chr(9)", Replacement:="_", LookAt:=xlPart, SearchOrder _ :=xlByRows, MatchCase:=False, SearchFormat:=False, ReplaceFormat:=False End Sub -- Don Guillett Microsoft MVP Excel SalesAid Software dguillett1@austin.rr.com "Phil Hibbs" <snarks@gmail.com> wrote in message news:0b76279b-a698-4a37-a05c-d48a902167a9@v23g2000pro.googlegroups.com... >I have spreadsheets (provided by ...

Search Key Not Found while searching in a form
I can search in a table using the "binoculars" with no problem. When I try to do the same in a form, I get the message "search key not found". How do I correct this so I can search in a form? -- Emperial Free Luminesce "blue10liberty" <blue10liberty@discussions.microsoft.com> wrote in message news:DE9EA5D0-B5D0-46F0-BA08-70FD646181BD@microsoft.com... > I can search in a table using the "binoculars" with no problem. When I > try to do the same in a form, I get the message "search key not found". > How do I correct...

Search Companion
I have two hard drives - 'C' is internal and 'I' is an external USB drive. I do not want to ever search the external 'I' drive. In Search Companion I select just the 'C' drive (instead of 'C;I') and the search functions properly. I then close and reopen the Search Companion and the default search has switched back to 'C' and 'I'. Is there anyway to retain my defaults that I want to search? Thank you in advance. ...

Select contact then hangs
Hi, please help. I have a user that when she selects a contact using To: in a new email, after selecting 2, it closes outlook??. Spec is W2kSP4\office2k with all windows updates and office updates installed. Profile has been deleted and re-created, plus i have set up personal folders and moved contacts into there, and set that folder as a default, but makes no difference. Please help. ...

Selecting rows from various sheets
Hi all, I have several sheets with a few columns in each. One colum in each sheet has a unique value. Most of these unique values are th same in each sheet but not all. Is there any way that I can set up new sheet that will have the unique value in column 1 and th corresponding column values frommeach sheet beside it. For example Sheet 1 aa 1 1 1 bb 2 2 2 cc 3 3 3 Sheet 2 aa 4 4 cc 5 5 Result aa 1 1 1 4 4 bb 2 2 2 cc 3 3 3 5 5 Thanks alot, Sha -- sha ----------------------------------------------------------------------- shav's Profile: http...

Replace text
I have a column of names. On any cell that ENDS with a space followed by a single character (regardless of what it is)I want to remove the space and character. Ex: Williams, Henry B would change to Williams, Henry Hi! =if(mid(A1,len(A1)-1=" "), left(A1,len(A1)-2),A1) Al -- Message posted from http://www.ExcelForum.com Assuming your data in Col A, in cell B1 put the following formula and copy down =IF(ISERROR(SEARCH(" ?",RIGHT(A1,2))),A1,LEFT(A1,LEN(A1)-2)) Then copy the data in Col B, paste special as values over A and delete Col B -- Regards Ken...

outlook files taken over by www.jraun search
Hi Anyone have this problem. My outlook personal files systems open to a search through www.jraun.com. I cannot seem to get rid of this problem is it a new trojan or something? "ncw" <anonymous@discussions.microsoft.com> wrote in message news:<03bc01c3c36b$fc7c2fe0$a501280a@phx.gbl>... > Hi > Anyone have this problem. My outlook personal files > systems open to a search through www.jraun.com. I cannot > seem to get rid of this problem is it a new trojan or > something? I've got it too. No luck in getting rid of it yet. ncw <anonymous@discus...

select text in Calendar
I'm working on a calendar in Publisher. I'm adding text into a cell by spacing down 1 point, then typing in 8 points. Doing fine until April. At that time, I can only select cells (whole days). It will not let me select the text. Help is no help. Any hints out there. Did I accidentally select something to do this? Bonnie Have you added a picture to the cell or a shape? If you have send it to the back, make the cell no fill and try again. -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "GoBonnieGo" <GoB...

macro to filter data based on selected data
Hi, I am looking for a macro that requests input of a reference code and then a date and then filters the data in my spreadsheet based on this criteria. I am using excel 2007. Any help with this will be greatly appreciated. You can probably record a macro while doing it manually and then clean it up and add input boxes to ask the question or input your variable in a cell and use that. If all else fails, If desired, send your file to my address below. I will only look if: 1. You send a copy of this message on an inserted sheet 2. You give me the newsgroup and the ...

Search #11
This is way beyond my skill level so I decided to come here first. I need to search within a cell and add up all of the numbers. The problem is the numbers lie within text A1 contains this: Green(17) Red(12) Blue(16) Orange(230) So the search function would add up all the numbers of the cell and return 275 -- Brad1982 ------------------------------------------------------------------------ Brad1982's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=15690 View this thread: http://www.excelforum.com/showthread.php?threadid=501093 Assuming your values are in A1...

Google Search Add-in update
Hi all If you use this add-in then update it to version 6.01 Reason : The product specific Knowledge Base search is not working in version 6.0 anymore because Microsoft changed there Knowledge Base search. I update the Excel add-in to version 6.01 to fix this. http://www.rondebruin.nl/Google.htm -- Regards Ron de Bruin http://www.rondebruin.nl Thanks Ron. Will go get and implement. -- Don Guillett SalesAid Software donaldb@281.com "Ron de Bruin" <rondebruin@kabelfoon.nl> wrote in message news:unUTwWnzEHA.3376@TK2MSFTNGP12.phx.gbl... > Hi all > > If you use t...

Link select with a blast
I have Win 7 Home Premium, x64. Quite often, when I select a link, a mouse pointer changes to a palm with a blast. I understand, the palm is the standard mouse pointer for link select, but what is the blast? What it indicates? -- Ilya Zeldes Fort Myers, Florida Hi Ilya, I suspect that this is being caused by a tracking program. Run something like Ad-Aware and see if it indicates a tracking company. If so, you can delete it, however, it might prevent you from accessing that particular website. Dave "Ilya Zeldes" wrote in message news:7A6FF9B1-5512-44...

File search Dir() problem with large directories
Please somebody help me with my code. I am read almost every post regarding the changes to filesearch in 2007 and transfered my program over the to utilise the Dir() function . However when search large directories (files over around 100,000) the code falls over - losing network connection and stating invalid function. Could somebody advise if my code is at fault? Function findfilespath(pathname As String, tmpfilenametype As String, tmpdelete As String, tmpsource As String) Dim dbsanother As Object, rstfiles As Recordset Set dbsanother = CurrentDb Set rstfiles = dbsanother.OpenRec...

Select Case in a Change Event
Hi, I am trying to use a worksheet Change Event to trap changes to specific columns. depending on which column is chnaged by the user, the value in another ciolumn will be altered; so, changes in either column O or P will update column Q, changes in either column T or U will update column V and changes in column Z or AA will update column AB. What I can't figure out is the Select Case bit (where I've got the shouted question below). Here's what I've put together, any comments would be much appreciated. Private Sub Worksheet_Change(ByVal Target As Range) ...

Select Records based another table...
This may be very elementary, but i can't wrap my brain around it. I have tried to dummy it down as much as i can for myself, with plans of adapting it into something working. I have three tables that look like the following: Tbl 1: ProdID A B C 1 $1 $2 $3 2 $4 $5 $6 3 $7 $8 $9 Tbl 2: RmNum ProdID 1 3 1 2 2 1 2 2 Tbl 3: RmNum Style 1 A 2 C Relationships are: [tbl1 ProdID] ------ [tbl2 ProdID] [tbl2 RmNum] ...

Multi-Select List Box Does Not Retain Selected Items
I created an Outlook Form in 2003. But when I select items in the list box they do not remain select when I select another control on the form. Any suggestions? Did you bind the list box to a keywords field? -- Sue Mosher, Outlook MVP Author of Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "kaykay" <anonymous@discussions.microsoft.com> wrote in message news:276dd01c4638d$bd5af590$a501280a@phx.gbl... > I created an Outlook Form in 2003. But when I select > items i...

VBA
I am very new to VBA and access and have a question regarding a SELECT statement. I am going to run a select (recordset - so I can loop through and process each record) but on my SELECT I want to make sure I return at least 20 rows, otherwise I am going to change my WHERE clause to include more rows. Is there an easy way to do this or do I need to just do an inital SELECT COUNT(*) and then decide which WHERE clause to use?? Do you have an example I can look at? Thank you in advance! AJ On Fri, 14 Dec 2007 17:14:00 -0800, AJ <AJ@discussions.microsoft.com> wrote: I would not first ...

Drop down list quicker selection
We are using Excel 2003 We created a drop down list using the Data\Validation process, which works fine. When the arrow within a cell is clicked on to show the drop down list, how can you quickly select one of the many names in the list just by typing the first character of a name within the list. At the moment, we have to scroll up and down the list to select a particular name, which in itself isn't a problem, but slows down the process of finding the right name. Can the names within the list be alphabetically grouped when inputting the first character from the keyboard, and spee...

Selected fields to update
I need to have the ability, in OL'07, when I try to copy in a contact and am told there is a duplicate, to be able to select which fields I want updated and which not. Is that possible built-in or add-in? -- Boris You may find this of interest - ContactGenie DataPorter 2.0 - specifically handles updating of pre-existing contacts allowing you to define which fields you want to import/update from your input data file (custom forms/fields supported). Features: http://www.contactgenie.com/cg20features.htm Download" http://www.contactgenie.com/cg20dlorder.htm Karl _...

Change Form/Report Query Based on User Selection
I have a form and report based on a query. I need to change the query based on what the user selects on a form. Using VBA in MS Access 2002, can I change a single field in an existing query from GROUP BY to LAST? This process would be initiated by a click event on a form. Thanks in advance for any help. I would say only if you are willing to construct the entire query string in VBA and then apply that string as the source of the report. John Spencer Access MVP 2002-2005, 2007-2009 The Hilltop Institute University of Maryland Baltimore County Wayne wrote: > I have a form ...