ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Find And Run Robot

what is happening in this key sequence?

<< < (2/4) > >>

mackal:
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 *.
-mouser (August 23, 2007, 03:04 PM)
--- End quote ---

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".

mouser:
by the way for any given custom regular expression you can add this feature yourself if you are daring.

You basically add a second capture group to the regular expression, and use that in the alias "Result Filter" box.

So for example instead of:
^tor (.*)
You would match on
^tor (.*) [--(.*)]?

(actually im not sure about that []? part but if you know regular exressions im trying to add a second expression that is optional).

Then in the Result Filter box you put $$2


Having said that i think it's smarter to add a generic way of applying result filtering to regular expression results and so i will add it, just have to decide on the special characters to use for it.

nitrix-ud:
Having said that i think it's smarter to add a generic way of applying result filtering to regular expression results and so i will add it, just have to decide on the special characters to use for it.
--- End quote ---

those are all very good ideas !

another suggestion :
a second edit box below the search box or on the right... (optionnal of course ;))
the tab key would cycle through the search box, the filter box, the result (if tab autocompletes is unchecked)

the workflow would be amazing
example :
search keyword {TAB} goo
yubnub keyword {TAB} imdb

That would be so GREAT  :D
please do that  :P

in case you don't do it, i would use this autohotkey script

--- ---#IfWinActive,  Find and Run Robot v2 ahk_class TMainForm
Tab::
SendPlay, {Space}--
return
 #IfWinActive


Cheers, nitrix

nitrix-ud:
So for example instead of:
^tor (.*)
You would match on
^tor (.*) [--(.*)]?
--- End quote ---

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

mackal:
So for example instead of:
^tor (.*)
You would match on
^tor (.*) [--(.*)]?
--- End quote ---

i could not make this to work but i'm really interested in making the filter optional
anyone knows how to solve that ?
-nitrix-ud (August 23, 2007, 04:55 PM)
--- End quote ---

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.


   
   

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version