It's interesting why that many people insist on '.*$' to end their regexes;
isn't it generally implied?
'^[a-c].*' -> '^[a-c]'


On Sat, Oct 3, 2026 at 7:05 PM Myrddin Emrys <[email protected]> wrote:

> I'm no expert in fish, even though it's my standard shell, but this feels
> like something you could customize with an alias.
>
> function rmr
>     if test (count $argv) -eq 0
>         echo "Usage: rmr <regex-pattern> [rm-flags]"
>         echo "Example: rmr '^[a-c].*'  # removes files starting with a, b,
> or c"
>         return 1
>     end
>     rm $argv[2..-1] (string match -r $argv[1] *)
> end
>
> Perhaps someone smarter than me could do it without requiring single
> quotes around the regex. You could probably also make some equivalent `rmg`
> variant by inserting some hellish Perl one-liner that converts glob syntax
> into regex.
> _______________________________________________
> Fish-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/fish-users
>
_______________________________________________
Fish-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/fish-users

Reply via email to