How do I search and replace in comments in Acrobat XI?

I use a Mac and just downloaded Acrobat Pro XI specifically to search and replace phrases in comments in a large PDF. According to this Adobe Help page, I should be able to do this: https://helpx.adobe.com/acrobat/using/searching-pdfs.html I copied the relevant section below and marked with ***. However, I don't see I don't see an arrow for the options that would allow me to include comments. I understand how to include the comments with advanced search, but I want to also replace text. I also checked in preferences and searched the forums. Could someone please advise and maybe include a screenshot, if possible. Thanks!
Choose Edit > Find (Ctrl/Command+F). 
Type the text you want to search for in the text box on the Find toolbar. 
To replace text, click Replace With to expand the toolbar, then type the replacement text in theReplace With text box. 
(Optional) Click ***the arrow ***next to the text box and choose one or more of the following: 
Whole Words Only 
Finds only occurrences of the complete word you type in the text box. For example, if you search for the word stick, the words tick and sticky aren’t found.
Case-Sensitive
Finds only occurrences of the words that match the capitalization you type. For example, if you search for the word Web, the words web and WEB aren’t found.
Include Bookmarks
Also searches the text in the Bookmarks panel.
***Include Comments***
Also searches the text of any comments.

Here are screenshot of my attempts to make reducing double returns to one. First up selection of a double return:
Copy to the clipboard. Do a Command-F. Here's the resulting dialogue:
I paste in the contents of the clipboard:
Note the Search field no longer has an empty slot selected. Something is clearly in there, but no instance of whatever is has been found. Nevertheless, I proceed to set up the Replace field by selecting a single return:
Copy that to the clipboard and paste into the Replace field:
Nothing to search for and therefore nothing to replace. Am now wondering what that little scoop to the right of the eyeglass icon might indicate. Clicking on it reveals this:
Definitely not "a solution that just works."

Similar Messages

  • How do I search and replace for invisibles in Pages 5.5.2?

    Three related problems all involving search and replace for invisibles.
    1. A block of text where all double returns need to become single returns.
    2. A block of text where all returns need to be replaced with a single word space.
    3. A block of text where all double word spaces to be replaced with a single word space.
    Pages 09 could do all three this handily. How can these be done in Pages 5.5.2?
    Appreciated.

    Here are screenshot of my attempts to make reducing double returns to one. First up selection of a double return:
    Copy to the clipboard. Do a Command-F. Here's the resulting dialogue:
    I paste in the contents of the clipboard:
    Note the Search field no longer has an empty slot selected. Something is clearly in there, but no instance of whatever is has been found. Nevertheless, I proceed to set up the Replace field by selecting a single return:
    Copy that to the clipboard and paste into the Replace field:
    Nothing to search for and therefore nothing to replace. Am now wondering what that little scoop to the right of the eyeglass icon might indicate. Clicking on it reveals this:
    Definitely not "a solution that just works."

  • How can I search and replace fonts?

    iOS 7 doesn't support the Adobe workhorse fonts I've most relied on for years, and arbitrarily changes them to iOS built-in fonts when I link my standard documents and templates to the iPhone, via iCloud. There's no apparent logic to how it does this; a Pages document in Minion Pro, a serif font, gets changed to the sans-serif Helvetica. Myriad Pro may come out in Times New Roman. I accept that the iPhone's limited number of fonts makes translation necessary, but does Pages offer a way in which I can search and replace inappropriately substituted fonts for more logical alternatives?

    You noticed the first one yourself: the Found item list seems to randomly jump around the document -- I believe you are correct in your observation it may be due to the object construction order. That tells me, by the way, something about your lot numbers that tou didn't mention: your text is not one continuous long threaded story, but it's all or partially in disconnected etxt frames. The Found list does return everything inside a single story in the correct order, but it goes over each separate story in the order they were constructed.
    The only solution is to gather all of your lot numbers, *re-sort* them according to the page number they appear on (and some sort of Worst Case Scenario is when you might have more than one lot number frame per page; in that case you also need to sort by textframe, top to bottom -- yet even worse is if you also may have these textframes side by side!).
    Only then you have a reliable counting order.
    This isn't too bad. We can just extend the method I offered for sorting top-to-bottom/left-to-right in Re: Working around the frame selection order issue in CS 4 and make it also include page numbers:
    function byPageYX(a,b) {
        var
            aP = a.parentTextFrames[0].parentPage.index,
            bP = b.parentTextFrames[0].parentPage.index,
            aY = a.baseline[0],
            bY = b.baseline[0],
            aX = a.horizontalOffset[1],
            bX = b.horizontalOffset[1],
            dP = aP-bP,
            dy = aY-bY,
            dx = aX-bX;
        return dP?dP:(dy?dy:dx);
    myResults.sort(byPageYX);
    Or something like that.
    As for actually implementing the above I cannot be of any help with Applescript.
    Once we're dealing with sorting I think you're much better off in Javascript anyhow.

  • How to recursivly search and replace nodes in a document

    Hi,
    i am trying to go through a document that i ahve parsed, and search for and replace specific node values. I am putting the root node in as the element to start searching from.
    My code is below, can somone please point out where i am going wrong?
      //Sets the existing text node with the new value as selected by the user
         public static void setTextNode(Element e, String aTagName, String aTagValue, Document doc)
               NodeList children = e.getChildNodes();
               //Loop through all the outer elements
               for (int i=0; i<children.getLength(); i++)
                    Node childNode = children.item(i);
                    if (childNode instanceof Element)
                         Element childElement = (Element)childNode;
                         //Loop through all the children of this element to check for the tag we are looking for
                         NodeList childElementChildren = childElement.getChildNodes();
                              for (int j=0; j < childElementChildren.getLength(); j++)
                                   Node chNode = childElementChildren.item(j);
                                        try
                                             Element elem = (Element)chNode;
                                            if (elem.getChildNodes().getLength()> 1)     
                                                 setTextNode(elem, aTagName, aTagValue,doc);
                                            else
                                                 if (elem.getTagName().equals(aTagName))                         
                                                      Node node = childElement.getFirstChild();
                                                      node.setNodeValue(aTagValue);
                                        catch (Exception io)
                                             io.printStackTrace();
                              }

    Yes, this replaces your code. If you look at the example I posted before you can see that it replaces existing text values with the new value. The only thing it doesn't do is add the text to tags that don't have an existing text node. So
    <NodeA><NodeB>stuff</NodeB><NodeB></NodeB></NodeA>with "aTagName=NodeB" and "aTagValue=newVal" comes back as
    <NodeA><NodeB>newVal</NodeB><NodeB></NodeB></NodeA>Notice, the second NodeB did not have the value added. If you want it to add a text node if there isn't one so it comes back as
    <NodeA><NodeB>newVal</NodeB><NodeB>newVal</NodeB></NodeA>then make it look like this:
        public static void setTextNode(Node node, String aTagName, String aTagValue)
            if(node.getNodeType() == Node.ELEMENT_NODE)
                NodeList children = node.getChildNodes();
                int numChildren = children.getLength();
                if(numChildren == 0)
                    if(node.getNodeName().equals(aTagName))
                        // If there aren't any children but the tag is what we are looking for
                        // add a new text node with the passed value.
                        Document doc = node.getOwnerDocument();
                        Text txtNode = doc.createTextNode(aTagValue);
                        node.appendChild(txtNode);
                else
                    // If there are children loop through them
                    for(int i=0; i<numChildren; i++)
                        Node child = children.item(i);
                        short type = child.getNodeType();
                        if(type == Node.ELEMENT_NODE)
                            // If its an element node, recursively call our method to keep looking
                            setTextNode(child, aTagName, aTagValue);
                        else if(type == Node.TEXT_NODE && node.getNodeName().equals(aTagName))
                            // Change the value of this node's text-type child node
                            child.setNodeValue(aTagValue);
        }Just replace your method with this and give it a shot. If you have a Document you can call it like this:
    setTextNode(document.getFirstChild(), tagName, tagValue);If you try it and still don't understand, let me know and I'll try to help you integrate it in your code.
    -Paco

  • How can I search and replace the order items appear in the document?

    Here is my script. I am trying to replace instances of a text pattern (Lot ^9^9^9^9^9) with an auto incremented number Lot 1, Lot 2, Lot 3, etc... I believe this script produces unexpected results becuase the search result is ordered by document construction. The first item in myfounditems is the last item added to the document (which is on the last pages of the document), the second item in myfounditems is the next to last item that was added to the document (which was moved to a middle page in the document). The net result is that instead of having the first item on the first page being Lot 1) and the item directly below it being Lot 2), my document is a hodgepodge of Lot numbers is a seeminlgly random order. Any thoughts on how to fix this?
    tell application "Adobe InDesign CS5.5"
      --Clear the find/change preferences.
              set find text preferences to nothing
              set change text preferences to nothing
      --Search the document for the string "lot".
              set find what of find text preferences to "Lot ^9^9^9^9^9)"
      #set change to of change text preferences to "Lot " & lotnum & ")"
      --Set the find options.
              set case sensitive of find change text options to false
              set include footnotes of find change text options to false
              set include hidden layers of find change text options to false
              set include locked layers for find of find change text options to false
              set include locked stories for find of find change text options to false
              set include master pages of find change text options to false
              set whole word of find change text options to false
              tell active document
                        set lotnum to 1
                        set myFoundItems to find text
                        repeat with foundItem in myFoundItems
                                  set contents of object reference of foundItem to "Lot " & lotnum & ")"
                                  set lotnum to lotnum + 1
                        end repeat
              end tell
    end tell
    display dialog ("Numbered " & (count myFoundItems) & " lots in this document. Next starting lot number is " & lotnum & ".")

    You noticed the first one yourself: the Found item list seems to randomly jump around the document -- I believe you are correct in your observation it may be due to the object construction order. That tells me, by the way, something about your lot numbers that tou didn't mention: your text is not one continuous long threaded story, but it's all or partially in disconnected etxt frames. The Found list does return everything inside a single story in the correct order, but it goes over each separate story in the order they were constructed.
    The only solution is to gather all of your lot numbers, *re-sort* them according to the page number they appear on (and some sort of Worst Case Scenario is when you might have more than one lot number frame per page; in that case you also need to sort by textframe, top to bottom -- yet even worse is if you also may have these textframes side by side!).
    Only then you have a reliable counting order.
    This isn't too bad. We can just extend the method I offered for sorting top-to-bottom/left-to-right in Re: Working around the frame selection order issue in CS 4 and make it also include page numbers:
    function byPageYX(a,b) {
        var
            aP = a.parentTextFrames[0].parentPage.index,
            bP = b.parentTextFrames[0].parentPage.index,
            aY = a.baseline[0],
            bY = b.baseline[0],
            aX = a.horizontalOffset[1],
            bX = b.horizontalOffset[1],
            dP = aP-bP,
            dy = aY-bY,
            dx = aX-bX;
        return dP?dP:(dy?dy:dx);
    myResults.sort(byPageYX);
    Or something like that.
    As for actually implementing the above I cannot be of any help with Applescript.
    Once we're dealing with sorting I think you're much better off in Javascript anyhow.

  • Replacing soft returns with hard returns in search and replace PM7

    How do I search and replace soft returns in PM7 with a
    hard return? What do I type in the find box?

    Yes BigJohnD,
    That is the answer! Thanks so much.
    I had hunted for that chart but had not found it yet.
    Thanks again, You have been so helpful.
    MargoHollis

  • How Do I Mass Search and Replace Swatch Colors In Entire Indesign CS6 Document?

    I've jumped from CS4 to CS6 and its been a little while since, but just trying to refamiliarize myself with the many Features of Indesign CS6.
    Here's my issue: I have a really old CS4 document I've opened up and saved in CS6. I have to change all swatch colors throughout the document from pantone swatch 295 C to updated pantone swatch 293 C.
    Question, without my having to go through the entire document one object at a time looking for each object, HOW do i perform a Mass search and replace of Color swatch references from 295 C to 293C.
    I thought i could just click swatch properties and update the color... but No... that doesnt work as swatch properties is just grayed out
    I'm sure i've overlooked something but a refresher on how to mass find and replace color in a document would be great.
    Thanks and looking forward to hearing from someone.

    Thanks for the tips.... both seem like good options without my having to purchase a 3rd party software to accomplish this...
    I must admit... Because I've been stuck in Web Design and Motion Graphics for the past couple of years, when I re-opened my old print work from the CS4 days into CS6 it is obvious I have some catch up to do....
    I was almost embarrassed to admit I had forgotten the technique of Alias one color to another using Ink Manager... I had to look it up and found this helpful tutorial http://indesignsecrets.com/alias-one-color-swatch-to-another.php
    Thanks for both solutions....

  • In Pages, how to search and replace text involving invisible characters?

    In Pages documents, how to search and replace text involving invisible characters, colors and font sizes—a task which is so easy in Mircosoft Word?

    I read that an older version of Pages allowed users to enter special characters in the search/replace fields, but this did not work for me.
    Here: http://www.macworld.com/article/1156533/pagesspecialcharacters.html
    I still am looking for a way to do this.

  • How to get numeric result from 'search and replace' string function

    hii
    i am using search and replace function to get output.my output is of form ' *X0123.3 ' .here i am replacing the term *X01 with space because i need only 23.3 as a result.but i am unable to get that out in the output indicator.i used lot of functions like string to number and so on but i am getting output as zero .can you please suggest me wt to do.i am attaching a copy of my file.
    Attachments:
    Untitled 1.vi ‏25 KB

    Your problem is the fact that you are converting it to an integer, thus loosing the fractional part. You need to use "Fract/Exp String To Number" instead and create a DBL so yor data is 23.3 instead of 23.
    You also don't need to manipulate the string if the initial part is of constant lenght. Just use the offset input as in the figure below.
    Message Edited by altenbach on 07-31-2006 07:02 AM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    ToDBL.png ‏2 KB

  • How to search and replace in an xml file using java

    Hi all,
    I am new to java and Xml Programming.
    I have to search and replace a value Suresh with some other name in the below xml file.
    Any help of code in java it is of great help,and its very urgent.
    I am using java swings for generating two text boxes and a button but i am not able to search in the xml file thru the values that are entered into these text boxes.
    Thanks in advance.
    **XML File*
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <student>
    <stud_name>Suresh</stud_name>
    <stud_age>40</stud_age>
    </student>Also i am using SAX Parser in the java program
    any help of code or any tutorials for sax parisng is very urgent please help me to resolve this problem
    Edited by: Karthik84 on Aug 19, 2008 1:45 AM
    Edited by: Karthik84 on Aug 19, 2008 3:15 AM

    Using XPath to locate the elements you are after is very easy.
    Try something like this:
    import java.io.File;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.stream.StreamResult;
    import javax.xml.xpath.XPath;
    import javax.xml.xpath.XPathConstants;
    import javax.xml.xpath.XPathFactory;
    import org.w3c.dom.Document;
    import org.w3c.dom.NodeList;
    import org.xml.sax.InputSource;
    public class BasicXMLReplaceWithDOM4J {
         static String inputFile = "C:/student.xml";
         static String outputFile = "C:/studentRenamed.xml";
         public static void main(String[] args) throws Exception {
              // Read xml and build a DOM document
              Document doc = DocumentBuilderFactory.newInstance()
                        .newDocumentBuilder().parse(new InputSource(inputFile));
              // Use XPath to find all nodes where student is named 'Suresh'
              XPath xpath = XPathFactory.newInstance().newXPath();
              NodeList nodes = (NodeList)xpath
                   .evaluate("//stud_name[text()='Suresh']", doc, XPathConstants.NODESET);
              // Rename these nodes
              for (int idx = 0; idx < nodes.getLength(); idx++) {
                   nodes.item(idx).setTextContent("Suresh-Renamed");
              // Write the DOM document to the file
              Transformer xformer = TransformerFactory.newInstance().newTransformer();
              xformer.transform(new DOMSource(doc), new StreamResult(new File(outputFile)));
    }- Roy

  • Can I do search and replace in a batch?

    Hi, Everyone:
    Years ago before I start useing Indesign, I had a Chinese Desktop Prepress program named Westwinner, With tahat I could create a file putting all entries  needed to search and replace in, and search and replace all of them in one shot. Now I wonder if I can do the same with Indesign CS4.
    For your reference, the file for batch search I used in Westwinner looks like that:
    x@x'
    y@y'
    z@z'
    etc.
    Thanks for everyone that reply!

    I meant that scripts can be edited in a plain text editor like Notepad on Windows or the equivalnet on Mac. You still need to understand the scripting language. That script should be availble in AppleScript, VBScript (which work only on Mac or Windows, repectively) or JavaScript, which is cross-platform.
    You don't actually need to edit the script itself very much, I suspect, if at all. In the Javascript version (I'm looking at that in the ESTK) on line 116 you'll see: var myFindChangeFile = myFindFile("/FindChangeSupport/FindChangeList.txt")
    This line is telling the script to find the file FindChangeList.txt in the FindChangeSupport folder which shoujld be inthe same folder as the the script itself. All of the instructions for want to find and how to change it are in that text file, which is a tab-delimited file with each find/change operation on a single line. The stucture of that file is described in the comments section above the script code, so you should be able to design a new file to do what you need to do, then change that single line defining the variable to find the new text file and save the script. If you replace the existing FindChangeList.txt with your own file you wouldn't even need to edit the variable, but the script as written is so useful I wouldn want to give it up, so I'd make a new text file, edit the variable, and save the script with a new name for your own searches.
    I'm not really a script writer, myself. I read javascript fairly well so I was able to see how this script works, but if you need more help you probably should move over to the scripting forum and talk to the real experts.

  • Does the labview 8.5 project have a search and replace option that appies to all vi's in the project?

    In 8.2, the only thing the project has to let you search for a vi is "Find vi's on disk", which is redundant since I can do that in windows explorer.  What I want is a way to search for vi's in my application the way the search and replace function works, except I want it to apply to all vi's in a project instead of just the vi's currently loaded in memory.  Do we have this in 8.5?
    -Devin
    I got 99 problems but 8.6 ain't one.

    I'll give an example of what I was trying to do yesterday in 8.2.  I tried to build a source distribution of a large instrument driver.  Since its an instrument driver there is no single top-level vi that contains all vi's - there are different categories of vi's to do different functions on my instrument.  When I'm doing the source distribution I have to do it in several stages since 8.2 doesn't do source distributions right - but thats not really what this post is about.  Anyway, every time I do the distribution I get an error saying CnvrtArrayIntoBitPattern.vi is password protected (and another engineer wrote it and I don't have the password).  So the build fails.  Now I don't know the password, I'll find it out later, but I at least want to know where in the hierarchy this vi is even being called.  I don't know where it is on disk, I don't know what is calling it, it isn't in the project explicitly, it's a dependency.
    If I had a top-level vi that loaded everything, I could just do a search and replace on that vi and find exactly where it is being called in seconds.  But since I am in a project and have no idea where to start looking, there is no way I can find this vi.  Ideally, in 8.5 there would be a search and replace menu option that searches all vi's in a project to find any calls to this vi.  I want to look for all instances of a vi in my project.  It sounds like you still can't really do that in 8.5.
    What I ended up doing is writing a vi that opens all vi's in a folder hierarchy on disk.  I don't know where this vi is, but all vi's in my project are in the same root folder.  So I run my program to open every single project vi.  Then since I know every single vi is open and loaded simultaneously I used the search and replace function on one of them to find all instances of CnvrtArrayIntoBitPattern.vi.  But that is a painstaking process to create a simple search function.
    I think NI is maybe misunderstanding how people are actually using a project.  Not every vi that is being called is going to be explicitly listed in the project.  (Its this same issue that makes source distributions impossible in 8.2 - you can't target dependencies to a support library so every dependency has to be explicitly listed in the project - which is virtually impossible because they are all in different locations and there are hundreds.)  Most people have lots of general purpose vi's they use in many different projects, and they are buried down in code so we aren't even sure where they are all being used.  The new searches you mention assume you already know where the low-level function is and you are looking for their callers.  But sometimes you don't even know where the low level function is.  What if its an NI directory function?  For example, "resample waveform.vi" is an NI function that changed its defaults in 8.2 which meant we had to find every single place we used it and wire "open-interval?" to a constant instead of depending on the default value.  Its in an NI library somewhere and is never listed as a project vi.  So when I needed to find every place through every project that I used this vi, I couldn't do it through  the project manager because there is no search function.  To be practical I add the project-specific vi's to the project, and maybe a couple support directories, but there will always be lots of vi's as dependencies.  But every now and then I'm still going to want to search for one of these vi's.  So in 8.5 there is there still no way to search for vi's that aren't explicitly listed in the project?
    -Devin
    I got 99 problems but 8.6 ain't one.

  • How do I find and replace a word in PDF?

    How do I find and replace a word in PDF?

    In the Find window (Ctrl+F) there's an option to replace the searched text.
    This is in Acrobat XI, and there's no Replace All-function.
    On Thu, Jan 15, 2015 at 4:27 PM, claireb88184899 <[email protected]>

  • How do you find and replace "within selected text" in a textedit document (version 1.8, mountain lion)

    In the textedit version on Snow leopard it was possible to search and replace within a peice of selected text only i.e. not the entire file. This was a very useful feature because you could select a paragraph and replace all occurences of word1 with word2 within that paragraph only! This feature appears to be missing from the mountain lion version of textedit (version 1.8). Or can anyone tell me how to do it ... ?

    Having 46 people view a post without replying is not unusual. Some people look at a question to see if it's something they'd like to know the answer to, and then come back  when it has eventually been answered.
    I'm not sure if you need to escape forward slashes in Dreamweaver's Find and Replace dialog box, but I normally do because both JavaScript and PHP normally use forward slashes as delimiters to mark the beginning and end of the regex like this:
    var pattern = /[A-Z]{4}/; // JavaScript
    $pattern = '/[A-Z]{4}/';   // PHP
    When a forward slash appears inside the regex, you need to escape it with a backslash to avoid confusion with the closing delimiter.
    As you have worked out, a capturing group is created by wrapping part of the regex in parentheses.
    If you want to match exactly 38 characters, you can use [\S\s]{38}. That includes spaces, newline characters, symbols, everything.
    If you're trying to find everything between two tags, you can do this:
    (<\/tag_name>)([^<]+)
    The closing tag is captured as $1 and everything up to the next opening tag is captured as $2.
    Learning regular expressions is not easy. I don't claim to be an expert, but I enjoy the challenge of trying to solve them. If you're interested in regular expressions, there are several books published by O'Reilly. "Mastering Regular Expressions" is the ultimate authority, but it's a difficult read (not because it's badly written, but because of the complexity of the subject). "Regular Expressions Cookbook" is very good. There's also a new "Introducing Regular Expressions", but I haven't read it.

  • Search and replace strings in a file while ignoring substrings

    Hi:
    I have a java program that searches and replaces strings in a file. It makes a new copy of the file, searches for a string in the copy, replaces the string and renames the new copy to the original file, thereafter deleting the copy.
    Now searching for "abcd", for eg works fine, but searching for "Topabcd" and replacing it doesnot work because there is a match for "abcd" in a different search scenario. How can I modify the code such that if "abcd" is already searched and replaced then it should not be searched for again or rather search for "abcd" as entire string and not if its a substring of another string.
    In the below code output, all instances of "abcd" and the ones of "Topabcd" are replaced by ABCDEFG and TopABCDEF respectively, whereas according to the desired output, "abcd" should be replaced by ABCDEFG and "Topabcd" should be replaced by REPLACEMEFIRST.
    try
              String find_productstring = "abcd";
              String replacement_productstring = "ABCDEFG";
              compsXml = new FileReader(compsLoc);
              compsConfigFile = new BufferedReader(compsXml);
              File compsFile =new File("file.xml");
              File compsNewFile =new File("file1.xml");
              BufferedWriter out =new BufferedWriter(new FileWriter("file1.xml"));
              while ((compsLine = compsConfigFile.readLine()) != null)
                    new_compsLine =compsLine.replaceFirst(find_productstring, replacement_productstring);
                    out.write(new_compsLine);
                    out.write("\n");
                out.close();
                compsConfigFile.close();
                compsFile.delete();
                compsNewFile.renameTo(compsFile);
            catch (IOException e)
            //since "Topabcd" contains "abcd", which is the search above and hence the string "Topabcd" is not replaced correctly
             try
                   String find_producttopstring = "Topabcd";
                   String replacement_producttopstring = "REPLACEMEFIRST";
                   compsXml = new FileReader(compsLoc);
                   compsConfigFile = new BufferedReader(compsXml);
                   File compsFile =new File("file.xml");
                   File compsNewFile =new File("file1.xml");
                   BufferedWriter out =new BufferedWriter(new FileWriter("file1.xml"));
                   while ((compsLine = compsConfigFile.readLine()) != null)
                         new_compsLine =compsLine.replaceFirst(find_producttopstring, replacement_producttopstring);
                         out.write(new_compsLine);
                         out.write("\n");
                     out.close();
                     compsConfigFile.close();
                     compsFile.delete();
                     compsNewFile.renameTo(compsFile);
                 catch (IOException e)
            }Thanks a lot!

    Hi:
    I have a java program that searches and replaces
    strings in a file. It makes a new copy of the file,
    searches for a string in the copy, replaces the
    string and renames the new copy to the original file,
    thereafter deleting the copy.
    Now searching for "abcd", for eg works fine, but
    searching for "Topabcd" and replacing it doesnot work
    because there is a match for "abcd" in a different
    search scenario. How can I modify the code such that
    if "abcd" is already searched and replaced then it
    should not be searched for again or rather search for
    "abcd" as entire string and not if its a substring of
    another string.
    In the below code output, all instances of "abcd" and
    the ones of "Topabcd" are replaced by ABCDEFG and
    TopABCDEF respectively, whereas according to the
    desired output, "abcd" should be replaced by ABCDEFG
    and "Topabcd" should be replaced by REPLACEMEFIRST.
    try
    String find_productstring = "abcd";
    String replacement_productstring = "ABCDEFG";
    compsXml = new FileReader(compsLoc);
    compsConfigFile = new
    BufferedReader(compsXml);
    File compsFile =new File("file.xml");
    File compsNewFile =new File("file1.xml");
    BufferedWriter out =new BufferedWriter(new
    FileWriter("file1.xml"));
    while ((compsLine =
    compsConfigFile.readLine()) != null)
    new_compsLine
    =compsLine.replaceFirst(find_productstring,
    replacement_productstring);
    out.write(new_compsLine);
    out.write("\n");
    out.close();
    compsConfigFile.close();
    compsFile.delete();
    compsNewFile.renameTo(compsFile);
    catch (IOException e)
    //since "Topabcd" contains "abcd", which is
    the search above and hence the string "Topabcd" is
    not replaced correctly
    try
                   String find_producttopstring = "Topabcd";
    String replacement_producttopstring =
    topstring = "REPLACEMEFIRST";
                   compsXml = new FileReader(compsLoc);
    compsConfigFile = new
    gFile = new BufferedReader(compsXml);
                   File compsFile =new File("file.xml");
                   File compsNewFile =new File("file1.xml");
    BufferedWriter out =new BufferedWriter(new
    dWriter(new FileWriter("file1.xml"));
    while ((compsLine =
    compsLine = compsConfigFile.readLine()) != null)
    new_compsLine
    new_compsLine
    =compsLine.replaceFirst(find_producttopstring,
    replacement_producttopstring);
    out.write(new_compsLine);
    out.write("\n");
    out.close();
    compsConfigFile.close();
    compsFile.delete();
    compsNewFile.renameTo(compsFile);
                 catch (IOException e)
    Thanks a lot!I tried the matches(...) method but it doesnt seem to work.
    while ((compsLine = compsConfigFile.readLine()) != null)
    if(compsLine.matches(find_productstring))
         System.out.println("Exact match is found for abcd");
         new_compsLine =compsLine.replaceFirst(find_productstring, replacement_productstring);
    out.write(new_compsLine);
    out.write("\n");
         else
         System.out.println("Exact match is not found for abcd");
         out.write(compsLine);
         out.write("\n");

Maybe you are looking for

  • Is SAP BI reporting is possible in ECC 6.0 with same client

    Hi all,                          My requirement is, we need to design SAP BI data flow in ECC 6.0 with same client only.  Now I am designing the BI data models as per the requirement of SD sales reports in ECC 6.0.For this, when i was extracting the

  • Nokia Phones - Windows 8.1, Firmware and Future

    Lots of posts about Windows phones and the Windows Phone 8.1 update and firmware update(s) that are not happening for Verizon customers.    The talk on the net is Verizon has discontinued the Lumia Icon, so I called Verizon to find out.   The rep. I

  • While backing up with Time Machine my MBA restarts

    I have MBA Mid 2011 and I am using my Go Flex Home Network drive (NAS) to back up my machine. SInce last couple of days while backing up my MBA is freezing with the white screen and going into a Limbo ( Yes like the the move inception it desnt wake u

  • ITunes & Telus Fast Dialup error-50

    I cannot get iTunes previews. I cannot download purchased music. Keep getting -50 errors. It appears that it is either a problem with my internet firewall or accelerator. I have tried to get help from ISP (Telus) to find out how to configure my syste

  • Creative MediaSource - AudioSync Lo

    I have a Nomad Jukebox 3 and recently got a new computer and installed Creative MediaSource version 2.03.29 on it. On my old computer this application had an essential feature called 'AudioSync' which would keep the music on my computer in sync with