Bug 338006 - Captures seemingly not allowed in pattern string [GrepView GUI Madness]
Summary: Captures seemingly not allowed in pattern string [GrepView GUI Madness]
Status: CONFIRMED
Alias: None
Product: kdevelop
Classification: Applications
Component: All editors (other bugs)
Version First Reported In: 4.6.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: kdevelop-bugs-null
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-08-03 15:35 UTC by Albert Zeyer
Modified: 2025-03-28 11:20 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Albert Zeyer 2014-08-03 15:35:51 UTC
I wanted to search for a regexp, and I typed in the pattern "\((.*)->flags \& SDL_SRCCOLORKEY\)".

It shows me the error: "Failed: Captures are not allowed in pattern string".

I'm not even sure what that means. It should show me some more information about that.

Anyway, I don't think that this is an error. This should be a valid regexp. I want to replace it with "Surface_HasColorKey(\1)" after that.
Comment 1 Milian Wolff 2014-08-25 08:58:51 UTC
odd, this was explicitly disabled by commit

commit 5bb9829c377f80b6e1e96e8fcd90f918f83ecf44
Author: Julien Desgats <julien.desgats@gmail.com>
Date:   Mon Oct 25 16:44:21 2010 +0200

    Added a replacement template

The commit message doesn't really tell much about *why* this was done though. Julien, do you remember anything about that?
Comment 2 Milian Wolff 2014-08-25 09:10:13 UTC
ok, this thing GUI horribly complicated - we should try to simplify it in the future. I'll leave this bug open to remind us about it.

As a workaround, you have to do the following:

Pattern: .*
Template: \((%s)->flags \& SDL_SRCCOLORKEY\)
Replacement Template: Surface_HasColorKey(\1)

afaik that should do the trick. Some notes:

Pattern is not actually the pattern :) It's just a part that will be put into the pattern _template_, i.e. %s in the "template" will be replaced by the "pattern". The template *can* contain captures, but not the pattern... And to make things worse: the pattern must not be empty :-/

The "replacement template" can contain capture references and will be used to replace all matches. It can contain a %s which will be replaced by the "Replacment Text", which - again - must not be empty (ugh)...

Sorry for the mess, we'll try to improve this in the future.
Comment 3 Justin Zobel 2021-03-09 22:48:31 UTC
Thank you for the bug report.

As this report hasn't seen any changes in 5 years or more, we ask if you can please confirm that the issue still persists.

If this bug is no longer persisting or relevant please change the status to resolved.
Comment 4 David Redondo 2025-03-28 11:20:59 UTC
Still a concern, just fought with this, and it being a spearate modal dialog does not help with quickly iterating so this does what I actually want. 

Most editors, shows the search/replace in the main window. 

In general the template buisness is just to confusing, no normal user can understand it, the manual doesnt mention it and if it was not for milians comments here I dont know if we had any documentation at all. Maybe the best would just to take a step back and be inspired  what Kate has or just reuse it.