-
Hi, I have a conflict with two aliases. To reproduce, make these two regex aliases:
^(.*)\s\s$
and
^aa((?: .*|))$
If I type "aa[space]" in FARR the first alias is mistakenly triggered. Is that a bug?
-
strange.. can i ask if you haven't given a NAME to the first alias that might cause it being triggered?
-
No this reproduces whatever name I set for it.
More testing: if I open the "edit group alias" window for the first alias and enter "aa " in the test box it (correctly) says "no match" in red text. But I enter "aa " (without quotation marks) in the regular FARR inputbox the first alias runs. Weird!
I tried tweaking the second alias into the below, but the problem is still there.
^aa( .*)$
edit:
hm, if I use this the problem also occurs
^aa(|.+)$
but if I use this there is no problem
^aa(| .+)$
A drawback is that with this last regex the alias first runs on "aa", then a regular FARR search is shown on "aa " and then the alias runs again on "aa test". I use this alias to on "aa" list all files in a folder and on "aa test" list all files in that folder matching the phrase test. Anyway, I don't understand why the problem appears in all but the last version of the regex.
-
I cannot reproduce it.. i suspect the problem is caused by interaction with another alias.
Try this:
type "bb "
if this does not mistakenly trigger your first alias, then you know the problem is not with your first alias, but with some other interaction with ANOTHER alias triggering on the aa.
-
"bb " does nothing. But what makes me think there is some issue with FARR here is that if I change the second alias from
^aa(|.+)$
to
^testing(|.+)$
I still have the problem i.e. "testing " triggers the first alias.
I have checked my list of aliases and found no third alias triggering on "aa" (nor on "testing"). Could this be related to the fact that the aa-alias is designed to trigger both on "aa" and on "aa whatever"?
Anyway, since
^aa(| .+)$
works good enough I'm by now just curious why there is a difference.
edit: Let me add that the two aliases are used to launch these actions
^aa(|.+)$
aa | dosearch C:\test\ $$1
^(.*)\s\s$
dolaunch copyclip $$1 ;;; C:\ev2.exe
where ev2.exe is my workaround autohotkey script that passes a search to everything (https://www.donationcoder.com/forum/index.php?topic=31718.0)
-
Aha! The problem is a space in the dosearch command string. If I change
aa | dosearch C:\test\ $$1
into
aa | dosearch C:\test\$$1
the problem is solved.
-
I'm still a bit confused but it sounds like you are saying that what happened was the proper alias was triggered and then as it's action it replaced the search with text that immediately matched the other alias.
-
The problem is with the aa alias.
You are capturing the space with the search string.
So when you type in aa[space]
FARR captures the space as $$1. Then in turn, you pass $$1 along to the result and have dosearch C:\test\[space][space]
that triggers the other alias that matches on \s\s.
I think it is good practice not to capture the space before the parameters. There is less chance of bugs like this.
-
mouser & skajfes: you are right, thank you for the explanation. :Thmbsup:
skajfes: good practice in general - agreed! But in this particular case I wanted the alias to trigger first on "aa" (show all files in a folder) and on "aa somephrase" (show files in the folder matching "somephrase") *and* not switch back to a regular FARR search inbetween that. For that I needed the first space included in the match pattern.
-
If I understand you correctly you can write a regex like this with same effect:
^aa\s?(.*)$
-
Yes, you're right, thanks! But why didn't I think of that? :-[ :D
-
No problem. I use regex fairly often, so this is a simple problem for me :)
Btw, thanks for the donation :Thmbsup: