Summary: | grouping and back-references in regular expressions | ||
---|---|---|---|
Product: | [Unmaintained] klipper | Reporter: | Christoph Lange <langec> |
Component: | general | Assignee: | Esben Mose Hansen <kde> |
Status: | RESOLVED FIXED | ||
Severity: | wishlist | CC: | kde-bugzilla |
Priority: | NOR | ||
Version: | unspecified | ||
Target Milestone: | --- | ||
Platform: | unspecified | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: | |||
Attachments: |
grouping support
klipper-grouping.patch |
Description
Christoph Lange
2004-12-10 19:58:01 UTC
Well, Klipper currently uses QT's regular expression library, which supports what you want: http://doc.trolltech.com/3.3/qregexp.html#capturedTexts This should be a simple task for anyone who wants to do it; if noone else does I will get around to it :) hi there, i have a patch for this, attached. so now, in addition to '%s', you also have %n, where n is a non-negative integer. %0 is equivalent to %s, %1 matches the first group, etc. values of n greater than the largest group index don't get expanded. my reason for choosing %n instead of \n or $n is that this way i could use the kmacro expansion stuff out of the box (so no ugly string mangling or anything). the patch is fairly minimal, and i did a cursory valgrind check to make sure that it wasn't leaking memory (though someone more familiar with QStringList might want to double check my logic). sean Created attachment 20802 [details]
grouping support
see previous comments.
oh btw, you might notice i removed myCurrentAction... it wasn't being used at all anyway (and sent me down the wrong path for a bit :p ) I'll look at the patch today. Thank you for making it :) Sorry, I didn't notice this before, but this patch is against the 3.5.x series branch. I'm not sure if new features are accepted against this branch at all, but in any case, I don't feel I can apply the patch on the branch. Any chance of a patch against trunk? I tried to apply it, but it looks like it would need a bit of work to be ported. hi,
On Saturday 09 June 2007 11:16:43 Esben Mose Hansen wrote:
> ------- Sorry, I didn't notice this before, but this patch is against the
> 3.5.x series branch. I'm not sure if new features are accepted against this
> branch at all, but in any case, I don't feel I can apply the patch on the
> branch. Any chance of a patch against trunk? I tried to apply it, but it
> looks like it would need a bit of work to be ported.
well.. that's what i got to work with. it looks like the layout is different
in the latest svn than the kdebase debian source package. where do i find
klipper's source in trunk?
sean
Klipper has moved one directory in, under workspace svn+ssh://esben@svn.kde.org/home/kde/trunk/KDE/kdebase/workspace/klipper > ------- Additional Comments From kde mosehansen dk 2007-06-09 13:12 > ------- Klipper has moved one directory in, under workspace > > svn+ssh://esben svn kde org/home/kde/trunk/KDE/kdebase/workspace/klipper cool, used anonsvn to get at it from there. attached is an updated patch which i think should work against trunk. most of the changes were noise from nearby changed code. so my added code is still the same, minus a typechange from QIntDict to Q3IntDict somewhere, since i was following the lead of the myCommandMapping, which also had this change. i haven't tried compiling it, but don't imagine that there should be any significant problems. also, this new patch doesn't contain the removal of myCurrentAction from the affected files, but grep shows this variable to still be there and unused, so you might want to take it out while you're at it. sean Created an attachment (id=20816) klipper-grouping.patch SVN commit 814585 by pino: add a parent of the command items, and a way to get the captured matches from the action items this way, we can replace up to 9 submatches in the regexp of an action in the resulting command (and %0) too FEATURE: 94837 M +1 -1 configdialog.cpp M +18 -3 urlgrabber.cpp M +3 -1 urlgrabber.h WebSVN link: http://websvn.kde.org/?view=rev&revision=814585 |