Find and replace help needed deleting multiple Word bookmarks

I'm importing sections of a Word document. The Word documents have bookmarks such as:
    <h3><a name="_Toc226886762" id="_Toc226886762">Fixed-variable</a></h3>
I would like to do a sitewide search and replace, deleting all the bookmarks (they all start with Toc) but keeping the heading format and the text. I've tried various options, but nothing is working.
Thanks.

I just tried it again. When I clicked Replace All, the dialogue box disappeared. When I opened it again, I found a small square box at the end of the search string. When I tried to copy and paste it to here, it didn't show up.  <a name="_Toc[^>]+>([^<]+)</a>
When I was searching and getting no results, I had copied and pasted a section with only one bookmark in it. It was in the child of a template, but I can't see how that would make a difference.
Here's the code:
<div id="mainContent">
    <h2><a name="_Toc227356382" id="_Toc227356382">Combine  trips</a></h2>
    <p>Unless you live across the street from the grocery store,  consolidating shopping trips will save you time, gas, and reduce emissions. Unless  it’s a staple on sale, don’t buy what’s not on your list. </p>
    <p><em>Costco sells gasoline  for less than the local stations. We wait until the tank is close to empty and  the let the savings on gas pay for the trip.</em></p>
    <h2><a name="_Toc227356383" id="_Toc227356383">Compare  prices</a></h2>
    <p>Keep a small spiral notebook with prices of items you  purchase regularly such as rice, pasta, and dog food. A credit card size  calculator makes comparing prices easier.</p>
    <h2><a name="_Toc227356384" id="_Toc227356384">Check the  receipt</a></h2>
    <p>Computers don’t make mistakes, but operators do. If sales  prices aren’t entered into the system, the scanned price will reflect the  regular price. Some stores will give you the item for free if the scanned price  exceeds the price on the shelf. </p>
    <h2><a name="_Toc227356385" id="_Toc227356385">Price  matching</a></h2>
    <p>Some stores match competitors’ sales prices. Look for a sign  that says “Guaranteed low prices” and show them the ad. That can save you both  time and gas. Some promise to beat prices by 10%, so you can save money as  well. </p>
    <p>Many big box retailers demand exclusive manufacturer’s  numbers so they can evade making good on price matching guarantees.  The product may have a meaningless difference,  such as the color of the icons. </p>
<h3> </h3>
<p> </p>
<!-- end #mainContent -->
  </div>

Similar Messages

  • Find and replace help needed, multiple variables

    Hi everyone,
    Im trying to find all urls in my code that start in a particular way but have a number variable at the end, see examples below
    <a href="/example/examplefolder/enquiry.asp?pid=123">
    <a href="/example/examplefolder/enquiry.asp?pid=485">
    <a href="/example/examplefolder/enquiry.asp?pid=284">
    and replace them with one url, see example below
    <a href="/example/examplefolder/default.asp">
    How can I use Dreamweaver find and replace to achieve this across my whole website?
    So far I only know how to find one thing and replace with another, rather than finding variables and replacing them with one thing.
    Thanks for your help with this!

    In the Find field of the Find and Replace dialog box, enter this:
    (href\s*=\s*\"\/example\/examplefolder\/enquiry\.asp)\?pid=\d+(\")
    In the Replace field, enter this:
    $1$2
    Select the "Use regular expression" checkbox.
    Explanation:
    The two sets of parentheses are capturing groups, which capture the actual values as $1 and $2.
    The \s* matches zero or more spaces.
    \" matches a double quote.
    \/ matches a forward slash.
    \? matches a question mark
    \d+ matches one or more numbers.
    I have written a two-part tutorial on using regular expressions, which can be found here: http://www.adobe.com/devnet/dreamweaver/articles/regular_expressions_pt1.html.
    Message was edited by: David_Powers (adding explanation of double quote).

  • Find and Replace Font Colors in Multiple Text Boxes

    Hello,
    I have Illustrator version 15
    I made many text boxes with multiple colors, red and black on each letter. I was wondering if there is a find and replace tool for multiple text boxes. I want to change the reds to black and the blacks to light grey. I tried clicking on change swatch color but it only worked for the letter I had selected, even with the global option selected. I then when to select -> Same -> Color Stroke but it just selected each text box on the page....Is there anyway to do this?
    Jordan

    Not exactly a find and replace but you can do it.
    Select the text frames yu want to change the colors using the shift key to click select the frames.
    Then go to Edit>Edit Color>Recolor Art
    You wll see a dialog with red and black bars along side two shorter bars click the shorter bars to select a New Color a color picker will appear you can use the swatches or the color mixer.
    There is a live preview /so you will see the change in case you want to pick a different gray, of course you can always go back to the recolor art dialog.
    I am afraid you manually have to select text frames with multiple colors in order to accomplish what you want but the method above I believe is the only want to change the colors.
    This video shows how the dialog works but pretend the one frame I did not select is another color.
    http://www.wadezimmerman.com/videos/RecolorText.mov

  • Find and Replace help

    Hi people,
    First time on here....
    Have a little problem...
    I want to use the regular expression functionality in the
    find and replace dialog. I want to replace each "; " with
    ";{carriage return}"
    tried using
    lookfor: ;
    replace ;\r
    \n, 0x09, and all sorts...
    could someone give me some pointers please?
    much appreciated.

    On Tue, 18 Apr 2006 15:38:09 +0000 (UTC), "ToonMariner"
    <[email protected]> wrote:
    > I want to use the regular expression functionality in
    the find and replace
    >dialog. I want to replace each "; " with ";{carriage
    return}"
    Find: ;
    Replace with: ;\n
    works for me.
    Gary

  • Need Help With find and Replace

    I am a little green to this all. I am trying to find and
    replace a word inside the edit region and Dreamweaver will not
    change it, because it says its inside a locked region, but its a
    editable region?
    I have about 900 pages I need to make this change on and was
    relying on the find and replace tool to do that. I tried differn't
    advanced options, nothing seams to change it. I am using cs3.
    Thanks for any help

    Using Templates with a 900 page site is a crime against
    humanity. You reach
    the optimal size for Templates between about 50 and 100.
    The error you are getting suggests that there are coding
    errors on the page
    (perhaps even unrelated to ANY DW Template markup). We'd need
    to see the
    page to make progress with what that might be, as Alan says.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "RyanWaters" <[email protected]> wrote in
    message
    news:ggs7fq$gnq$[email protected]..
    >I am a little green to this all. I am trying to find and
    replace a word
    >inside
    > the edit region and Dreamweaver will not change it,
    because it says its
    > inside
    > a locked region, but its a editable region?
    > I have about 900 pages I need to make this change on and
    was relying on
    > the
    > find and replace tool to do that. I tried differn't
    advanced options,
    > nothing
    > seams to change it. I am using cs3. Thanks for any help
    >

  • How can I find and replace multiple words at once?

    I need to be able to find and replace words into queens English. For example, I need to replace all instances of "color" with "colour," "tire" with "tyre" etc.
    I'm new to scripting, so simple answers would be appreciated :)

    Hi hobs707,
    Please use the below code for your required output:
    Replace ("color", "colour")
    Replace("tire", "tyre")           
    //Replace("hobs707", "hobs007")     just copy and paste and edit the contents as your wish
    function Replace(input, output)
    app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
    app.findTextPreferences.findWhat = input;
    app.changeTextPreferences.changeTo = output;
    app.activeDocument.changeText();
    If the above answer is correct please provide Correct Answers for me.
    Regards
    Beginner

  • How To: Find and replace multiple words in one Click ?

    I have an file with about 150 Pages where I want to replace a word about 500 time by one click.
    Find and Replace works but only with one word.
    How can I do it by one click ?

    You can't, not in Acrobat anyway.
    This is the kind of thing that should be done in the original file format,
    not in a PDF.

  • Find and Replace Issue Help Requested.

    Hi all. I've been digging around for a couple of days and
    can't seem to figure this one out. For starters, I have already
    looked at the Regular Expression syntax and tried the MS word
    clean-up option, but no luck. We have about 1,500 pages of content.
    They are in DNN, so the pages are created dynamically.
    Unfortunately, the page content was written in Word and then dumped
    in DNN. We are trying to clean up the pages. We are grabbing the
    content from Dot Net Nuke and putting it into Dreamweaver 8.0.2.
    Then we are manually cleaning out things like:
    <?xml:namespace prefix = o ns =
    "urn:schemas-microsoft-com:office:office" />
    and
    <P class=MsoNormal style="MARGIN: 0in 0in 0pt"
    align=left>
    We are using the Find and Replace funtion in Dreamweaver to
    clean out these commands, but I know from the documentation, there
    is an easier way to clean these pages.
    Bottom Line: Since the pages are dynamically built, I know I
    have to grab the page content and put it in Dreamweaver manually
    and then put it back in DNN, but I am trying to find a way (using
    Regular Expressions or something) to look for all the little
    variances of MSO, <?XML, etc. in a straight shot. I would like
    to find a way to use a wild card to look for all tags that have MSO
    or Microsoft or ?XML in them and then replace them with a null
    value. From what I can tell, the Find would have to use a wildcard
    because the advanced find features don't carry what I am looking
    for. Something like Find \<?xml * [<-wildcard] to \> to
    grab the entire tag. The Find tag command doesn't work because the
    tags I need aren't listed. Also, because the content is dynamic, I
    can't do a Fins and Replace against the entire site for these
    commands, but it would be nice to "Find" all of these items with a
    single pass since the "Replace" value is always null.
    The wildcard syntax and multiple Find instances are the main
    questions. The wildcards seem to be character or space specific.
    Sorry for the long explanation - I just don't want to waste
    anyone's time typing responses to things I've already tried to do.
    Thanks in advance for any help. This is my first time back in
    the forums in about 4 years.

    sadamec1 wrote:
    > Well David, you Findmaster - it worked! (At least it
    found and highlighted the
    > code). Now, I need to dig through what you sent me and
    compare it against my
    > regular expression definitions to find out how to grab
    the rest of these
    > phrases. You're the best. Thank you!
    Glad that it did the trick. Just to help you understand what
    I did,
    there are two main sections, as follows:
    <\?xml[^>]+>
    and
    <[^>]+(?=class=Mso)[^>]+>
    They are separated by a vertical pipe (|), so they simply act
    as
    alternatives.
    The first one searches for <?xml followed by anything
    except a closing
    bracket until it reaches the first closing bracket.
    The second one is more complex. It begins with this:
    <[^>]+
    This simply looks for an opening bracket followed by anything
    other than
    a closing bracket. What makes it more intelligent is the next
    bit:
    (?=class=Mso)
    This does a forward search for "class=Mso". It's then
    followed by this
    again:
    [^>]+>
    That finds anything except a closing bracket followed by a
    closing bracket.
    The bit that you need to experiment with is (?=...). It's
    technically
    called a "forward lookaround". The effect is that the second
    half of the
    regex finds <....class=Mso....>.
    David Powers
    Adobe Community Expert
    Author, "Foundation PHP for Dreamweaver 8" (friends of ED)
    http://foundationphp.com/

  • How do I create a multiple find and replace for Excel in AppleScript?

    I have a large dataset in Excel that I have to do a multiple find/replace in (changing USPS state abbreviations to their full names). In searching the Microsoft boards--I was directed to use Applescript, and even the documented help with Excel was recommeding this. Unfortunately, there wasn't much help potinting me in the specific direction I needed. Any ideas on how I should write this script?
    Thanks!

    I'm confused as to why Applescript (or any script would be helpful).
    You'd have to type the abbreviation and the full name into the script, the same as just using Find and Replace All. You wouldn't gain anything by using a script. Is there more to this task than you've let on?
    MacTech has an article on converting from VBA to Applescript, but I'm not sure if it would have any ideas on your specific problem: http://www.mactech.com/vba-transition-guide/index-toc.html

  • How to create mail merge(feature in word) in adobe pdf and programmatically find and replace these t

    I am very new to adobe.I am required to do the following and am very confused.The scenario is as follows:
    I am required to create a letter template (using adobe designer) where name and few other details will be tags(which needs to be replaced by actual values according to the particular customer later on).We can create such a feature in word using mail merge feature available there.How do we do the same in pdf??Can it be done using adobe designer 7.0???If so,how?
    After I create this template,I am required to write a javascript or a VB program to access this pdf template and find and replace these tags with the actual values and generate a pdf document.Somebody told me that this is to be done using adobe document server(ADS). Can this be done??If so,how?If not what is the alternative product in adobe?
    There are so many adobe products that i am totally at sea and not able to figure out which to use and how.
    Please help me at the very earliest.
    Thanks in advance.
    regards,
    Sowmya

    Let me thank u for a prompt reply but I guess I still need ur help before I accomplish what I set out to do.
    As per your reply I used Forms API in my vb program and it is accessing the fields but I am not able to change the property of the fields.
    I created the pdf form using adobe designer 7.0 and have created a floating field which I want to populate using my code.This is invisible in the pdf template but I when I set the value for it using vb code I need to change its property to visible.
    But when I try to change the "NoViewFlag" property, I get an error as follows:
    Runtime error'-2147220988(80040204)
    Document's Security Settings prohibit the operation being performed
    Please give your suggestions.
    2.Another question is how do I differentiate floating text field and ordinary text field in vb code because the type of both is displayed as text ??
    Thanks again.
    regards,
    Sowmya
    I am putting my code below for ur viewing.

  • Find and Replace multiple line PHP comment

    Greeting everyone!
    Hopefully this question is asked in the right place.
    I have about 300 php files that have multiple line PHP
    comment that start with /* and end with this */. I want to remove
    all the comments since I am trying to reduce the file size as much
    as possible. The comments are no longer needed and I have tried
    many different configureation in the dreamweaver find and replace,
    but for the life of me I cannot seem to get it to work. I even
    tried useing regular expressions, but the astrick * is a wild card
    the the code tags contain an astrick.
    Is it possible to do this in dreamweaver, or will I need to
    hand edit every page?
    Thank for help
    example

    I am not sure of the exact syntax but open the find replace
    function on a page and play with find syntax search feature from
    the drop down menu . If I am not mistaken you should be able to to
    search from the beginning of a comment tag to the end of one and
    grab whats in between. From the help file
    Use the Find And Replace dialog box to search for text or
    tags in a document, and to replace the found material with other
    text or tags.
    Select Edit > Find And Replace.
    In the Search pop‑up menu, select Specific Tag.
    Select a specific tag or [any tag] from the pop‑up menu
    next to the Search pop‑up menu, or type a tag name in the
    text box.
    (Optional.) Limit the search with one of the following tag
    modifiers:
    With Attribute Specifies an attribute that must be in the tag
    for it to match. You can specify a particular value for the
    attribute or select [any value].
    Without Attribute Selects an attribute that must not be in
    the tag for it to match. For example, select this option to search
    for all img tags with no alt attribute.
    Containing Specifies text or a tag that must be contained
    within the original tag for it to match. For example, in the code
    <b><font size="4">heading 1</font></b>, the
    font tag is contained within the b tag.
    Not Containing Specifies text or a tag that must not be
    contained within the original tag for it to match.
    Inside Tag Specifies a tag that the target tag must be
    contained in for it to match.
    Not Inside Tag Specifies a tag that the target tag must not
    be contained in for it to match.
    (Optional.) To limit the search further, click the Plus (+)
    button and repeat step 3.
    If you didn’t apply any tag modifiers in steps 3 and 4,
    then click the Minus (-) button to remove the tag modifiers
    pop‑up menu.
    If you want to perform an action when the tag is found (such
    as removing or replacing the tag), select the action from the
    Action pop‑up menu and, if applicable, specify any additional
    information necessary to perform the action.

  • Need advanced "Find and Replace" method

    I have bunch of pages need "Find and Replace" work in html
    coding, but I can't use DW's "Find and Replace" function to do with
    it. Here's the sample code:
    quote:
    "<tr valign="top"><td align="center"><a href="
    ../photo/ccg/pages/Columbus Grill
    M_jpg.htm"><img src="../photo/ccg/thumbnails/Columbus
    Grill M_jpg.gif" border="0" onClick="MM_openBrWindow('
    ../photo/ccg/pages/50th Yard
    M_jpg.htm','rr','width=386,height=306')"><br>
    Columbus Grill M</td>
    <td align="center"><a href="
    ../photo/ccg/pages/Columbus Grill
    W_jpg.htm"><img src="../photo/ccg/thumbnails/Columbus
    Grill W_jpg.gif" border="0" onClick="MM_openBrWindow('
    ../photo/ccg/pages/50th Yard
    M_jpg.htm','rr','width=386,height=306')"><br>
    Columbus Grill W</td>
    <td align="center"><a href="
    ../photo/ccg/pages/Cookies Lounge
    M_jpg.htm"><img src="../photo/ccg/thumbnails/Cookies
    Lounge M_jpg.gif" border="0" onClick="MM_openBrWindow('
    ../photo/ccg/pages/50th Yard
    M_jpg.htm','rr','width=386,height=306')"><br>
    Cookies Lounge M</td>
    <td align="center"><a href="
    ../photo/ccg/pages/Cookies Lounge
    W_jpg.htm"><img src="../photo/ccg/thumbnails/Cookies
    Lounge W_jpg.gif" border="0" onClick="MM_openBrWindow('
    ../photo/ccg/pages/50th Yard
    M_jpg.htm','rr','width=386,height=306')"><br>
    Cookies Lounge W</td>
    <td align="center"><a href="
    ../photo/ccg/pages/Corcorans
    M_jpg.htm"><img src="../photo/ccg/thumbnails/Corcorans
    M_jpg.gif" border="0" onClick="MM_openBrWindow('
    ../photo/ccg/pages/50th Yard
    M_jpg.htm','rr','width=386,height=306')"><br>
    Corcorans M</td>
    </tr>"
    You can see I need to use EVERY highlighted code to replace
    each NEXT bolded code, highlighted code are deffirent but bolded
    code are the same. Now I just do it manually, but there are
    thousands of them.
    Is any one has a better method using DW's "Find and Replace"
    function to do this job automatically?

    Using Templates with a 900 page site is a crime against
    humanity. You reach
    the optimal size for Templates between about 50 and 100.
    The error you are getting suggests that there are coding
    errors on the page
    (perhaps even unrelated to ANY DW Template markup). We'd need
    to see the
    page to make progress with what that might be, as Alan says.
    Murray --- ICQ 71997575
    Adobe Community Expert
    (If you *MUST* email me, don't LAUGH when you do so!)
    ==================
    http://www.projectseven.com/go
    - DW FAQs, Tutorials & Resources
    http://www.dwfaq.com - DW FAQs,
    Tutorials & Resources
    ==================
    "RyanWaters" <[email protected]> wrote in
    message
    news:ggs7fq$gnq$[email protected]..
    >I am a little green to this all. I am trying to find and
    replace a word
    >inside
    > the edit region and Dreamweaver will not change it,
    because it says its
    > inside
    > a locked region, but its a editable region?
    > I have about 900 pages I need to make this change on and
    was relying on
    > the
    > find and replace tool to do that. I tried differn't
    advanced options,
    > nothing
    > seams to change it. I am using cs3. Thanks for any help
    >

  • Batch Edit Multiple HTML files | Find and Replace

    Hi,
    I would like to use Automator to automate (I know that sounds redundant) the following process.
    1. Take a group of html files
    2. Open each file so it can find and replace the script of any image folders
    Example:
    Change: img src="home_files/photo.jpg" to img src="images/photo.jpg"
    3. Save & Close each file
    I assume this this would have to be done in either AppleScript or Cocoa.
    Any help would be greatly appreciated.
    Thanks in advance.

    you most definitely don't need Cocoa for something like that. if all you need is a straightforward search and replace in a bunch of html files you can easily do this with a shell script. If you need some more involved search and replace you have to explain what it is exactly that you want.
    to automate direct search and replace you can do something along the following lines in automator
    1. get selected finder items (this will select your html files)
    2. run shell script action with input passed as arguments
    <pre style="
    font-family: Monaco, 'Courier New', Courier, monospace;
    font-size: 10px;
    margin: 0px;
    padding: 5px;
    border: 1px solid #000000;
    width: 720px;
    color: #000000;
    background-color: #ADD8E6;
    overflow: auto;"
    title="this text can be pasted into the Script Editor">
    for f in "$@"
    do
    fl=`echo "$f"`
    sed 's%home_files/photo.jpg%images/photo.jpg%g' $f > /users/$USER/.tmp.txt
    cat /users/$USER/.tmp.txt > "$fl"
    done
    rm /users/$USER/.tmp.txt</pre>

  • How to use Microsoft Word's Find and Replace with HTML tags?

    Hello to all!
    I'm trying to figure out how to use the find and replace function in Word to replace html tags. I'd like to be able to change something like this:
    <span class="B01-K-ITAL">random text</span>
    To something like this:
    <em>random text</em>
    I want to replace the open and close tags without changing or interfering with the text between the tags. I'm pretty sure I should use wildcards, but I can't figure out how to use them properly.
    Anyone able to lend a hand?

    Here is my latest regular expression with Perl.   I think it matches the spirit of the request in the original post.
    Note, this isn't as easy as you think.  You need to code up the complete set of html rules in you implementation. You need to allow for a certain amount of mal-formed html.
    perl -0660pe 's^<[sS][pP][aA][nN]\s+class="B01-K-ITAL"\s*>(.*?)</[sS][pP][aA][nN]>^<em>$1</em>^gs' i.html >|o.html
    input text
     <html> <head>...</head> <body>I'd like to be able to change something like this: <span class="B01-K-ITAL">#1 one line</span> I want to replace the open and close tags without changing or interfering with the text between the tags. I'm pretty sure I should use wildcards, but I can't figure out how to use them properly. <p>note, this isn't as easy as you think.  You need to code up the complete set of html rules in you implementation. You need to allow for a certain amount of mal-formed html.</p> <span class="B01-K-ITAL">#2 don't be greedy</span> <span class="B01-K-ITAL">$3 multiline text</span> <span class="B01-K-ITAL">#4 multiline tag. I believe html allow a carriage return in white space of tags</span> <span class="B01-K-ITAL">#5 split after the class tag. optional white space</span> <sPan class="B01-K-ITAL">#6 mixed case tag</Span> <p>no text #7</p><span class="B01-K-ITAL"></span> <!-- Apparently, this is valid     http://www.positioniseverything.net/articles/cc-plus.html --> <!--[if IE]> <div id="IEroot"> <![endif]--> <p id="IE">This browser is IE.</p> <p id="notIE">This browser is not IE.</p><!--[if IE]> </div> <![endif]--></body> </html>
    output text
     <html> <head>...</head> <body>I'd like to be able to change something like this: <em>#1 one line</em> I want to replace the open and close tags without changing or interfering with the text between the tags. I'm pretty sure I should use wildcards, but I can't figure out how to use them properly. <p>note, this isn't as easy as you think.  You need to code up the complete set of html rules in you implementation. You need to allow for a certain amount of mal-formed html.</p> <em>#2 don't be greedy</em> <em>$3 multiline text</em> <em>#4 multiline tag. I believe html allow a carriage return in white space of tags</em> <em>#5 split after the class tag. optional white space</em> <em>#6 mixed case tag</em> <p>no text #7</p><em></em> <!-- Apparently, this is valid     http://www.positioniseverything.net/articles/cc-plus.html --> <!--[if IE]> <div id="IEroot"> <![endif]--> <p id="IE">This browser is IE.</p> <p id="notIE">This browser is not IE.</p><!--[if IE]> </div> <![endif]--></body> </html>

  • Find and replace text in multiple Photoshop files?

    Hi there,
    Let us say I have six Photoshop files: 1.psd, 2.psd, ..., 6.psd. All of these files contain the word “LoremIpsum” in random text layers, within each document. Is there a way I can search for “LoremIpsum” in all documents and replace it with “Dolor Sit Amet”, all in one go? This is just an example, I need to replace various words, not just one.
    I have tried "batch find and replace" software (including powerful tools like Power Grep) but they do not work with psd files… Is there a javascript of external plugin for this kind of task?
    Thanks!

    You’re welcome, advice given here is free.
    If you want to donate something nonetheless you could do so over at
    http://ps-scripts.com/bb/
    Many of the same people used to contribute there as here and I for one have benefitted considerably from their generous advice on Scripting issues.
    A Script can read (or create) txt files, but I do not have a lot of experience with this.
    This might work (amend the line »var theTexts = readPref ("….txt", false);« according to your txt-file’s path):
    // replace text elements in type layers;
    // 2013, use it at your own risk;
    #target photoshop
    if (app.documents.length > 0) {
              for (var n = 0; n < app.documents.length; n++) {
                        app.activeDocument = app.documents[n];
                        app.activeDocument.suspendHistory("replace text", "main()")
    // the opertation;
    function main () {
              var myDocument = app.activeDocument;
              var theTexts = readPref ("….txt", false);
              var theArray1 = theTexts.slice(0, Math.round(theTexts.length/2));
              var theArray2 = theTexts.slice(Math.round(theTexts.length/2), theTexts.length);
              alert (theArray1.join("\n")+"\n\n\n"+theArray2.join("\n"))
              for (var b = 0; b < theArray1.length; b++) {
                        replaceText (theArray1[b], theArray2[b])
    ////// reoplace text //////
    function replaceText (replaceThis, replaceWith) {
    // =======================================================
    var idreplace = stringIDToTypeID( "replace" );
        var desc22 = new ActionDescriptor();
        var idnull = charIDToTypeID( "null" );
            var ref3 = new ActionReference();
            var idPrpr = charIDToTypeID( "Prpr" );
            var idreplace = stringIDToTypeID( "replace" );
            ref3.putProperty( idPrpr, idreplace );
            var idTxLr = charIDToTypeID( "TxLr" );
            var idOrdn = charIDToTypeID( "Ordn" );
            var idAl = charIDToTypeID( "Al  " );
            ref3.putEnumerated( idTxLr, idOrdn, idAl );
        desc22.putReference( idnull, ref3 );
        var idUsng = charIDToTypeID( "Usng" );
            var desc23 = new ActionDescriptor();
            var idfind = stringIDToTypeID( "find" );
            desc23.putString( idfind, replaceThis );
            var idreplace = stringIDToTypeID( "replace" );
            desc23.putString( idreplace, replaceWith );
            var idcheckAll = stringIDToTypeID( "checkAll" );
            desc23.putBoolean( idcheckAll, true );
            var idFwd = charIDToTypeID( "Fwd " );
            desc23.putBoolean( idFwd, true );
            var idcaseSensitive = stringIDToTypeID( "caseSensitive" );
            desc23.putBoolean( idcaseSensitive, false );
            var idwholeWord = stringIDToTypeID( "wholeWord" );
            desc23.putBoolean( idwholeWord, false );
            var idignoreAccents = stringIDToTypeID( "ignoreAccents" );
            desc23.putBoolean( idignoreAccents, true );
        var idfindReplace = stringIDToTypeID( "findReplace" );
        desc22.putObject( idUsng, idfindReplace, desc23 );
    executeAction( idreplace, desc22, DialogModes.NO );
    ////// read prefs file //////
    function readPref (thePath, binary) {
      if (File(thePath).exists == true) {
        var file = File(thePath);
        file.open("r");
        if (binary == true) {file.encoding= 'BINARY'};
        var theText = file.read();
        file.close();
        return String(theText).split(",")
    In this case the comma is used to split the text into Strings in Arrays, if your search/replace texts include commas you could use something else, I guess.

Maybe you are looking for