#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    218
    Rep Power
    12

    Find & Replace in Eclipse


    Hello,

    I have a file that contains the following:

    <definition name="page" value="xyxa">
    <definition name="page" value="xyxfaa">
    <definition name="page" value="xyewrewfex">
    <definition name="page" value="xyfdadfadfx">
    <definition name="page" value="xyxfdafddaf">
    <definition name="page" value="xyxdfa">



    I am trying to replace the value="...." with just value="" for now. Basically im trying to replace anythign in a value attribute with a blank. How can i do this? I am using eclipse search to do this.

    Thanks,
    SCott
  2. #2
  3. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2010
    Location
    Brisbane, Australia
    Posts
    20
    Rep Power
    0
    No idea how to do it in Eclipse, but this is how I would do it (in Windows):

    - Open the file in Notepad++
    - Open the search and replace dialog (Ctrl + H)
    - Enter the following in the search for box: value=".+"
    - Enter the following in the replace with box: value=""
    - Set the search mode to regular expression
    - Click the replace all button

    If you have more than one file, you can use Notepad++'s "Find in Files" option
  4. #3
  5. Sarcky
    Devshed Supreme Being (6500+ posts)

    Join Date
    Oct 2006
    Location
    Pennsylvania, USA
    Posts
    10,908
    Rep Power
    6352
    In eclipse, you can use find/replace as a regexp as long as you click the "regexp" button. Due to a java problem on my box, I can't actually test this, but:
    Code:
    find:  value="[^"]+"
    replace:  value=""
    -Dan
    HEY! YOU! Read the New User Guide and Forum Rules

    "They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety." -Benjamin Franklin

    "The greatest tragedy of this changing society is that people who never knew what it was like before will simply assume that this is the way things are supposed to be." -2600 Magazine, Fall 2002

    Think we're being rude? Maybe you asked a bad question or you're a Help Vampire. Trying to argue intelligently? Please read this.

IMN logo majestic logo threadwatch logo seochat tools logo