Welcome to WebmasterWorld Guest from 54.226.32.234

Forum Moderators: bakedjake

Message Too Old, No Replies

Klipper Regular Expression Processor

     

dstiles

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

WebmasterWorld Senior Member dstiles is a WebmasterWorld Top Contributor of All Time 5+ Year Member



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

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

WebmasterWorld Senior Member lucy24 is a WebmasterWorld Top Contributor of All Time Top Contributors Of The Month



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

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

WebmasterWorld Senior Member dstiles is a WebmasterWorld Top Contributor of All Time 5+ Year Member



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.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month