PyCharm: Record and Playback Macros

Viewed 55

I have many places in my code which look like this:

            sequential_number='BDKJ-2017-4',
            sequential_number_for_ordering='BDKJ-2017-000000004',

They should finally look like this:

            sequential_number='BDKJ-{}-4'.format(year),
            sequential_number_for_ordering='BDKJ-{year}-000000004'.format(year),

I tried the Macro feature of PyCharm. I recorded the change of the first macro (first line), but the playback does not the desired change:

Result:

            sequential_number='BDKJ-{}-4'.format(year),
        -{}sequential_number_for_ordering='BDKJ-2017-000000004'.format(year),

During recording the macro I only used keystrokes and the "END" "POS1" keys (not the mouse), so that recording works.

pycharm-macro

Any clue how to get this working?

BTW: In this case a regular-expression would work, but I want to learn macro-recording for other use-cases.

0 Answers
Related