homepage Welcome to WebmasterWorld Guest from 54.197.94.241
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Visit PubCon.com
Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
Forum Library, Charter, Moderators: bakedjake

Linux, Unix, and *nix like Operating Systems Forum

    
Klipper Regular Expression Processor
dstiles




msg:4565376
 7:46 pm on Apr 16, 2013 (gmt 0)

I like klipper and use it dozens of times a day but three things I cannot figure.

1. Acquire a clip, paste it into something, highlight but not clip something else, actual clip stops being pasteable. It takes a View Clipboard and Enter on the top-most clip to re-instate it. Annoying but I can live with it. (I have Ignore Selection ticked so it's not that).

2. Left-click and right-click on the icon return different results: left often does not show the currently clipped item and sometimes loses several "admin" items from the bottom of the list. Again, I can live with it.

3. I cannot get regular expressions to work. This one IS annoying. My current example is:

Clip:
http://www.example.com/page/pid/abc123/title

Regex:
^.*/pid/ (action: Ignore)
^.*/ (action Add To Clipboard)

From this I expect the term abc123/ to be a new item on the clipboard. Dream on! :(

Best I can do is manually load the clip into klipper's item editor and change it manually.

I have tried enabling various Action flags but all I can get is loading the full page from the full URL.

Any ideas, please?

 

lucy24




msg:4565388
 8:36 pm on Apr 16, 2013 (gmt 0)

Clip:
http://www.example.com/page/pid/abc123/title

Regex:
^.*/pid/ (action: Ignore)
^.*/ (action Add To Clipboard)

From this I expect the term abc123/ to be a new item on the clipboard.

How does the Regular Expression know which piece of the URL you're talking about? Based on those two rules I'd expect the whole request to be ignored, since /pid/ occurs before the part you're interested in. Where do /page/ and /title go?

The form ^.*/ is always redundant; it's the same as saying / alone.

You're allowed to use .* here because it's a one-off. In Apache it would be a different story ;)

Now, obviously I don't know klipper but I know Regular Expressions. Does the documentation drop any hint about what RegEx dialect ("flavor") it uses? Or any constructions that are specific to klipper? Your examples include an opening anchor. That tends to imply that the Regular Expression will also recognize a closing anchor.

dstiles




msg:4565762
 8:53 pm on Apr 17, 2013 (gmt 0)

Thanks for the input, Lucy.

In context, I'm assuming that klipper will work through the list of regex creating (in this case) shorter strings on which to work (the actions I parenthesised are actual actions made by klipper during regex parsing - forgot to mention that and without klipper knowledge it would not make sense. :(

http://www.example.com/page/pid/abc123/title
to
abc123/title
then
abc123/

You're correct about the second opening anchor - missed that. It's supposed to be based on qt's QRegExp.

To be frank, I'd be happy if ANYTHING was placed on the clipboard - I could work from that.

You've jogged my mind on something, though: I'll have another look.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Hardware and OS Related Technologies / Linux, Unix, and *nix like Operating Systems
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved