Oracle SQL Developer 4 Quick Hit: Search and Replace

thatjeffsmith SQL Developer 16 Comments

Tell Others About This Story:

The new editor framework provides a more interactive and rich experience when replacing text. It’s a very simple improvement, but one that I think will make you feel ‘better.’ I know that’s a subjective measurement, but I’m sticking with it.

Our new Developer Days Lab with Oracle Database 12c and SQL Developer 4

Our new Developer Days Lab with Oracle Database 12c and SQL Developer 4

Each replacement is confirmed visually, in place, unless of course you opt for 'All.'

Each replacement is confirmed visually, in place, unless of course you opt for ‘All.’

And something I talked about earlier, double-clicking on a ‘word’ in the editor will auto-find and highlight all occurrences of that text. This is then automatically used as the basis of a search and replace exercise.

Double-click on the word, see the 'hits' and then do a one by one replacement if you'd like...

Double-click on the word, see the ‘hits’ and then do a one by one replacement if you’d like…

Regular Expression Validation

Thanks to Jack, I also just noticed that the search dialog auto-validates your RegEx search terms. The input text will remain ‘red’ until it’s a valid search term – this is of course after you toggle the ‘Regular Expressions’ checkbox on the search dialog.

As soon as I close that search term with the ']' the text will go from red to black.

As soon as I close that search term with the ‘]’ the text will go from red to black.

When Will This Fancy New Image Be Available for Download?

Soon. We’ll let you know as soon as it hits the presses. You can find the current version of it for download here.

Tell Others About This Story:

Comments 16

  1. Is there any way to have the ‘Selected Text Only’ tick box to stay ticked?

    currently every time I select a block of text that I would like to search and replace within, I need to recheck this box so that the changes are not made to the entire script. It is too easy to forget to do this!

    1. thatjeffsmith Post
      Author
    1. thatjeffsmith Post
      Author

      See my conversation with Alejandro Rodriguez above…we bugged it, and the JDev team fixed it in v4.1 – which isn’t available yet.

      In v4.1 you’ll use $ notation to reference back references for replace strings.

      1. Back reference notation for replace strings ($1 .. $9) works for expressions in brackets, but I could not figure out how to insert a newline into the replace string. >A\nBAnBA
        B<

  2. Yesterday I upgraded to 4.0.2.15 to find out that Regexp Replace back reference is no longer working.
    For example, I was trying to remove the upper() function from a query that has 62 instances of the function, so issued the following replace:
    Search for: (upper\()([^)]+)(\))
    Replace with: \2
    Got: “\2” instead of the column name.
    This is a feature that was working in 3.2, so I’m glad I didn’t remove it from my hard drive because it came handy today.

    1. I stumbled upon the same bug today and was very disappointed. I migrated from 3 to 4.0.316.84 only recently. Now I’m thinking about going back. Fully functional regexes are really important to me, as they keep up my productivity. Copying everything to Notepad++ to do the regex magic there isn’t really a solution…

      1. thatjeffsmith Post
        Author

        JDeveloper broke this when we went to version 4.0 and their new framework. I contacted the developer and logged the bug so that hopefully we can have it working as expected again in version 4.1.

          1. Hi Jeff,

            I just tried the search & replace in 4.1 (Version 4.1.0.17 Build MAIN-17.29, to be precise), hoping that the bug with regex back references would be resolved. Instead I see that search and replace with regexes has been broken completely. No matter which regular expression I enter, I always get a dialog box to the effect that this text hasn’t been found. Migrating to 4.1 feels like a downgrade to me…

            It would be great if you could ask the developers to incorporate the regex search & replace into the standard test suite to prevent disappointments there. Is there any hope of getting a fully functional regex search and replace back any time soon?

            Kind regards,
            Michael

          2. thatjeffsmith Post
            Author
  3. One of my favorite new features in the search box is notification via red text of an invalid regex, when “Regular Expressions” is checked. It has saved me from many a modal error box so far.

    1. thatjeffsmith Post
      Author
  4. Nice feature! The new editor framework really rocks! SQL Developer 4.0 is really going to be a huge step forward.

    1. thatjeffsmith Post
      Author

Leave a Reply

Your email address will not be published. Required fields are marked *