Regex Alias Filter Patterns

Top  Previous  Next

When creating an alias that uses a regular expression, you usually want to capture some part of the string typed by the user and use it in a file launching operation or web url.

 

[regular expression parsing is provided by the open source PCRE library]

 

For example you might use a regular expression like:

^search (.*)

 

With a result that opened:

http://www.google.com?search=$$1

 

In this way, the pattern matched by the (.*) is replaced in the url on launch.

 

 

Each alias can have multiple results that are shown on a match.

Normally, you want to display all results and let user choose from them like a menu.

However, it is now possible to let the user filter and score the results inside a regular expression alias, by specifying an optional filter/score pattern.

 

By specifying a filter/score pattern using the $$ notation, you can let the user filter only the results they want.

 


 

NEW:

 

You can use $$u1 and $$uc in place of $$1 and $$c to have FARR perform urlencoding on the arguments, making them suitable for web searches.

 

$$h1 can be used to do encoding of high ascii characters as &#XX; format

 


 

For example, in our search alias we might have 20 different search engines we know how to search.  So we configure our search alias with these 20 result urls, and we make the following changes in our regular expression alias:

 

Regular Expression:

^(.*) search (.*)

 

With RegEx Search Filter

$$1

 

And results:

http://www.google.com?s=$$2

http://www.yahoo.com?s=$$2

http://www.altavista.com?s=$$2

 

NOW, a user can type: yahoo search hello

And the $$1 group name (yahoo) will be used to filter out all results in the the result list that don't contain the word yahoo, while the $$2 phrase will be used for the actual search.

 


 

In the options you can choose whether Regex Filtering should differentially weight results or leave them in original order and just remove non-matching items.