Messages - mackal [ switch to compact view ]

Pages: prev1 2 [3] 4 5next
11
Find And Run Robot / Re: what is happening in this key sequence?
« on: August 23, 2007, 05:25 PM »
Incidentally, does anyone know where to find the regexp language specification for the regex engine in FARR?  Mouser?  I presume FARR uses an off-the-shelf/Net library, so maybe the docs for that library will specify this...

12
Find And Run Robot / Re: what is happening in this key sequence?
« on: August 23, 2007, 05:19 PM »
So for example instead of:
^tor (.*)
You would match on
^tor (.*) [--(.*)]?

i could not make this to work but i'm really interested in making the filter optional
anyone knows how to solve that ?

Generally "[]" in regex means any character from within those listed between the square brackets (e.g., "[Ii]gnore [Cc]apitalization [Ii]n [Ww]ords"), so this does not work.  To make the second term optional, you really need

^tor (.*) (--(.*))?

But I'm not sure how FARR regexp engine handles nested groups (i.e., "()") as far as assigning them to $$1, $$2, etc.  In some regexp implementations there is a way to specify that a particular "()" is being used only for grouping, and not for extraction; not sure if FARR engine supports that.  If not, then probably the outer group is assigned to $$2, while the inner group to $$3... so you would have to use $$3 in the result filter box.

EDIT: Ah, found it through experimentation, FARR using emacs-like syntax... here is what you want:

^tor (.*) (?:--(.*))?

or to answer my original post

^tor(?:rent)? (.*) (?:--(.*))?

In this particular regex syntax "(?:foo)" means "group foo, but do not extract to a positional parameter".  Thus "tor(?:rent)?", for example, means match either "tor" or "torrent", and if the latter, don't let it affect the meaning of $$1, etc.

EDIT#2: Oops, the latter part, the alias filtering doesn't work because regex engines are greedy and thus the first "(.*)" always matches everything, including any "-- whatever bits here".  It's tricky to do this cleanly.  The workaround I came up with, which is a bit kludgy, is to use:

  ^tor(?:rent)? (?:(.*) -- (.*)|(.*))()

and then modify the torrent search engine invocations to something like

  Mininova | http://mininova.org/search/?search=$$1$$3 /ICON=icons\mininova.ico

Note the $$1$$3 instead of just $$1.

Explanation:

^tor(?:rent)?
    This part is the same as before.

(?:(.*) -- (.*)|(.*))
    Either match strings of form "xxx ... -- yyy ..." or, if not possible (i.e., "--" does not exist), match everything else.
    The outer "(?: ...)" groups the expression, limiting the scope of the "|", but does not cause parameter extraction itself.
    The problem with this, and the ugliness, is that in the case where "--" is absent and the second case is used, that last "(.*)" is assigned to $$3, and not $$1; hence the need for "$$3$$1".

the trailing "()"
    This is necessary in the case where "--" is present, since in this case the last "(.*)" is not used, and thus $$3 does not exist; what ends up happening is that "$$3" is left verbatim in the invocation string.  This extra "()" thus causes $$3 to exist (and be empty) in this scenario; in the alternate case it simply generates a blank $$4.

Oof.  Ugly, I know, but it works.  A greater regex master than I needs to tell us what the proper way of doing this is, if it is even possible to do cleanly.


   
   

13
Find And Run Robot / Re: what is happening in this key sequence?
« on: August 23, 2007, 03:33 PM »
The first one is easy and that is to make the regular expression for this group match on "tor[rent] (.*)" (whatever the regex for that is) -- that would solve the main problem.

I was also thinking that to enable filtering on regular expressions, we could add a special character that would filter and NOT get matched against regular expressions.  So for example you could type:
"tor searchword *FILTER WORDS"

and it would match as if you typed "tor searchword", and THEN do a filter on results using everything after the *.

Ah, everything is clear now, thanks!  I don't know much (yet) about the mechanics of FARR in how it approaches regex extraction, but your second suggestions sounds excellent!  

An alternative suggestion for the "stop parsing" token would be to use "--"... there is some precedent for this in the UNIX/commandline world, where the token "--" signals to the shell/launcher to stop parsing for command line flags (of the form "-o" or "--another-option"), and simply pass the remaning arguments wholesale to the program invoked, even if they start with a dash.  So in the above example it could be "torrent keyword1 keyword2 keywordn -- nova".

14
Find And Run Robot / Re: what is happening in this key sequence?
« on: August 23, 2007, 03:26 PM »
To launch all results i think it's now Ctrl+Alt+Enter (not just Ctrl+Enter).. i forget why.

Yes, that was it, thanks.  It would be helpful to amend the help file then, where it still has the old binding.  It's under Advanced Use > Hotkey and Shortcut Summary.

Muahahahaha! >:D  I feel like an evil overlord of the universe with all that power at my fingertips now...  :D

15
Find And Run Robot / what is happening in this key sequence?
« on: August 23, 2007, 02:09 PM »
Hi all, I am really starting to get excited about the power of FARR as I slowly discover the new things in 2.0... but occasionally I'm having a hard time understanding what FARR is thinking/doing.  Here is one example in particular, perhaps someone can explain to me what is happening:

  • I hit Ctrl-Space, and FARR comes up
  • I type "tor"; the first entry is the "torrent" alias group in Core_Aliases\Core-Search.alias file
  • I hit Tab or Alt-1, at which point the alias is autocompleted to "torrent" and only the aliases in the group now appear in the result window
  • now when I type the next word, the additional text is used to filter the alias group to only those entries that match the typed text; makes sense
  • once I narrowed down the list of torrent search engines so that the one I want is the only one (or at least at top of list), if I hit space and add another word (presumably the search words), the result list goes empty and hitting Enter does nothing

???

Now, I understand on the lowest level that the problem is that the additional words in the last point are being treated as additional filtering to the list of aliases in the group.  But, how do I enter an argument for $$1 in that case?  Is FARR not supposed to be used in this fashion? (i.e., autocompletion with alias groups)

Of course the workaround is to not hit Tab/autocomplete the alias, but simply use something like "tor my search words" and then use Alt-<number> to fire up the desired search engine.  But the outlined approach above should also work, no?

On a related note, is there way to fire *all* the search engines?  According to help, hitting Ctrl-Enter should execute all the search results, but this only fires up the top-most torrent search for me... I've never actually gotten Ctrl-Enter to work (but haven't really tried it with executables).

Any help on any of the above points would be most welcome.

Pages: prev1 2 [3] 4 5next
Go to full version