How do i use 'Update Copyright...'

Answered

Hello everyone,

i'm trying to understand how to use the 'Update Copyright...' feature.

In my source files i have a header like this:

# This file is part of MyApp.
# Copyright © 2000-2018 MyApp Project
#
# MyApp is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 2 of the License, or (at your option)
# any later version.
#
# MyApp is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along
# with MyApp. If not, see <http://www.gnu.org/licenses/>.

In Settings > Editor > Copyright > Copyright Profiles i have added the above text and replaced 2018 with $today.year .

The regexp i set to Copyright © 2000-\d{4} MyApp and allow replacing string to Copyright © 2000-20[0-9][0-9] MyApp.

 

Now when using 'Update Copyright...' the first two lines will be replaced with the full copyright text. That means the text blocks 2-4 are now doubled.

# This file is part of MyApp.
# Copyright © 2000-2019 MyApp Project
#
# MyApp is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 2 of the License, or (at your option)
# any later version.
#
# MyApp is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along
# with MyApp. If not, see <http://www.gnu.org/licenses/>.
#

#
#
# MyApp is free software: you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation, either version 2 of the License, or (at your option)
# any later version.
#
# MyApp is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
# more details.
#
# You should have received a copy of the GNU General Public License along
# with MyApp. If not, see <http://www.gnu.org/licenses/>.
#

 

What do i have to enter where so that only the 2018 will be replaced?

 

0
1 comment

Hi,

I am able to reproduce your problem even with simpler regexp and allow replacing string to. I have filed an issue about it to our issue tracker https://youtrack.jetbrains.com/issue/IDEA-205320, please follow it for updates.

0

Please sign in to leave a comment.