Bug 168226 - KReplace: Placeholder substitution for regular expressions not implemented
Summary: KReplace: Placeholder substitution for regular expressions not implemented
Status: RESOLVED FIXED
Alias: None
Product: kdelibs
Classification: Unmaintained
Component: kdeui (show other bugs)
Version: unspecified
Platform: Debian testing Linux
: NOR normal
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords:
: 137374 140837 158397 227215 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-08-03 17:00 UTC by Christoph Burgmer
Modified: 2010-09-05 21:26 UTC (History)
3 users (show)

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


Attachments
Test case (1.09 KB, text/plain)
2008-08-03 17:05 UTC, Christoph Burgmer
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Christoph Burgmer 2008-08-03 17:00:08 UTC
Version:            (using KDE 4.1.0)
Installed from:    Debian testing/unstable Packages

KReplaceDialog [1] allows for replacing text matched by a regular expressions with substituting content from the match using placeholders (\0, \1...). This can be set by giving option BackReference = 512.

KFindDialog implements widgets for setting this option in [2].

KReplace only implements placeholder \0 though, which means only substituting the whole match.

Currently extracting a partial match from the given regular expression is not supported.

I consider this a bug as this functionality is clearly wanted by the UI but not given by the underlying library. This feature is used in the KTextEdit widget.

See the Kate implementation on replacing using placeholders [4]. Maybe this can be merged into KReplace.

[1] http://api.kde.org/4.x-api/kdelibs-apidocs/kdeui/html/classKReplaceDialog.html
[2] http://api.kde.org/4.x-api/kdelibs-apidocs/kdeui/html/kfinddialog_8cpp-source.html#l00116
[3] http://api.kde.org/4.x-api/kdelibs-apidocs/kdeui/html/kreplace_8cpp-source.html#l00250
[4] http://api.kde.org/4.x-api/kdelibs-apidocs/kate/html/katesearchbar_8cpp-source.html#l00338
Comment 1 Christoph Burgmer 2008-08-03 17:05:22 UTC
Created attachment 26601 [details]
Test case

See Bug 140837.

See attachment for a testcase. This is a PyKDE application that uses a
KTextEdit. For any string input a substring string "test" will be substituted
with itself and the whole input will be printed to stdout. "Test that" will
currently resolve to "\1 that" which shows that \1 is not substituted.
Comment 2 Christoph Feck 2010-01-05 20:10:08 UTC
*** Bug 137374 has been marked as a duplicate of this bug. ***
Comment 3 David Faure 2010-05-19 00:22:25 UTC
*** Bug 227215 has been marked as a duplicate of this bug. ***
Comment 4 David Faure 2010-05-19 00:28:43 UTC
SVN commit 1128317 by dfaure:

Finally implement support for other back references than \0 in the find/replace dialog.
BUGS: 168226 125443
CCBUG: 201057


 M  +25 -16    findreplace/kreplace.cpp  
 M  +19 -4     tests/kreplacetest.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=1128317
Comment 5 David Faure 2010-05-19 01:17:05 UTC
*** Bug 158397 has been marked as a duplicate of this bug. ***
Comment 6 FiNeX 2010-09-05 21:26:02 UTC
*** Bug 140837 has been marked as a duplicate of this bug. ***