Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Oomph » Simple "Find and Replace" TextModification
Simple "Find and Replace" TextModification [message #1823537] Sat, 28 March 2020 15:03 Go to next message
Sina MadaniFriend
Messages: 160
Registered: November 2015
Location: York, UK
Senior Member
Hi,
I've been tearing my hair out trying to edit the default workspace for a new install. The problem is on Windows this requires escaping backslashes in "configuration:/.settings/org.eclipse.ui.ide.prefs". So I have a TextModification task with the following properties:
<setupTask
        xsi:type="setup:TextModifyTask"
        url="configuration:/.settings/org.eclipse.ui.ide.prefs">
      <modification
          pattern="(.*=[A-Z]\:)(?:(\\)([\w|-]+))+">
        <substitution>\1</substitution>
        <substitution>\2\\</substitution>
        <substitution>\3</substitution>
      </modification>
      <description>Formats workspace path in RECENT_WORKSPACES</description>
    </setupTask>

The file is:
RECENT_WORKSPACES=C:\Users\Sina-\Epsilon\epsilon-Interim\workspace
MAX_RECENT_WORKSPACES=5
RECENT_WORKSPACES_PROTOCOL=3
SHOW_RECENT_WORKSPACES=false
SHOW_WORKSPACE_SELECTION_DIALOG=false
eclipse.preferences.version=1


It's obvious what I'm trying to do: replace \ with \\. But I'm not smart enough to work this out. I've looked at the source code and I get what it's doing, but for something so simple as this, isn't there an easier way?!
Thanks.

[Updated on: Sat, 28 March 2020 15:04]

Report message to a moderator

Re: Simple "Find and Replace" TextModification [message #1823551 is a reply to message #1823537] Sat, 28 March 2020 16:24 Go to previous message
Sina MadaniFriend
Messages: 160
Registered: November 2015
Location: York, UK
Senior Member
After many experiments, I managed to fix it with this simple trick.
Pattern: (\\+?)
Substitutions: \\
Previous Topic:Unexpected Variable Filter behaviour
Next Topic:installation.location/eclipse on macOS
Goto Forum:
  


Current Time: Fri Apr 26 22:52:15 GMT 2024

Powered by FUDForum. Page generated in 0.02564 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top