>> This works surprisingly well. Maybe there are more corner cases, >> but something already works with quick tests: >> >> diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el > > Yes, not bad indeed. Did you find any corner cases? Using a temporary buffer like you proposed works fine, and handles all possible regexps including corner cases. However, wouldn't this make the search too inefficient?