Messages - mostlytyping [ switch to compact view ]

Pages: [1] 2next
That is best solved by changing the regex from nn(.*) to ^nn(.*) so that it only matches if the nn is at the START of the string.
Thank you. I was going go respond that in my case I don't actually want the anchor as often I am remembering a fragment of the name of the URL that could be anywhere in the string.
E.g. to find "Learning Elisp for better Emacs" I might simply type "elisp".

However, having tried it, it works, which seems to run counter to what I know about regexes...

EDIT: Wrong again, I am actually using "nn(^.*)" rather than "^nn(.*)" but this "nn(^.*)" still seems to get me the behaviour I want?

Try putting $$1 in the the alias configuration dialog where it says "Result Filter for RegEx".
Thanks to everybody for their help. It is now working as I want it to.
I did find that using nn(.*) led to far too many false hits, but now that I have tweaked the regex to nn(??.*) it behaves more usefully.
Oh, and I also had to change the trigger from 'nn' to 'uu' as the former is found in a fair number of English words, which meant that searching for something like 'kennel' using other aliases would trigger it.

Having said all that, another possibly MUCH EASIER way to do what you want is not to make separate shortcut files, but make one test file with all the urls you want, and put it in a text file and create a "us" alias that uses the "filecontents" command to let farr search it.
if you have time, I have a follow-up question. I have been experimenting with the command mentioned above, but I cannot get it to work. In this case I have it bound to nn, as follows. I would expect that typing "nn emacs" would lead it to show a filtered list of all the entries extracted from the file using the filecontents command. Instead it just shows all the entries, without filtering at all (see below). I cannot work out what is going on. And yet I have a memory of it working a few days ago, so I think I have changed something but I don't know what.

This is how I set it up:


These are the contents of the file to which the alias refers:


And this is the result when I try to use the alias:


Any pointers would be gratefully received...

Sorted! Many thanks for all your help.

I agree, it doesn't seem to be triggering. And yet the alias is enabled:


And here the results of typing "us news" in the Test Regular Expression field - nothing.


I did try changing the alias trigger text to different strings, just in case there was some conflict somewhere with "us" but that did not help either.

Pages: [1] 2next
Go to full version