I wanted to use regular expressions in eclipse to adept code to a software update.
instead of
{$CFG->prefix}example1.xy
the code needs to be:
{example1}.xy
to work.
another example would be:
{$CFG->prefix}example2.foo
>
{example2}.foo
constant parts are : {$CFG->prefix}; .
i tried the following (i used whitespaces to make reading easier):
Find: \{\$CFG-\>prefix\} ([a-z]|[0-9])* \. ([a-z]|[0-9])*
Which will find the requested String. I struggle in replacing it.
i can use ,/1to store the result of the regex and use it in the replacement (right?) but i am not sure how i can modify/manipulate this result.
thanks for any help.
Try the following search and replace :
Find:
\{\$CFG->prefix\}([a-z0-9]*)\.([a-z0-9]*)Replace with :
{\1}.\2Using the above the following :
Here is a quick screen-cast to show this in action.
Changes made to the OP’s Find reg-ex
In order to get the above find-replace to work, I had to make the following changes to the OP’s find expression :
([...]*)instead of([...])*[a-z0-9]instead of[a-z]|[0-9]