Globbing versus regular expressions

Liste des GroupesRevenir à cu shell 
Sujet : Globbing versus regular expressions
De : mail (at) *nospam* axel-reichert.de (Axel Reichert)
Groupes : comp.unix.shell
Date : 21. Jul 2024, 09:01:18
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <87wmlf2pq9.fsf@axel-reichert.de>
User-Agent : Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux)
Hi all,

a colleague (new to command line wizardry) seemed puzzled by the
existence of both globbing for file names (shell) and regular
expressions for strings (many other command line tools).

Since I am familiar with both mechanisms for decades, I never thought
about this "redundancy", but now I think he has a point, even more so if
you are using the "dired" file manager in Emacs, which further blurs the
distinction between mangling text and working on files.

Since regexes are (at quick glance) a superset of globs, why not
consistently use the former for both file names and strings? The
few additional keystrokes (.* instead of *) are IMHO easily compensated
for by the more powerful capabilities of regexes.

A little reading on Wikipedia showed that both came into popular usage
in the early 70s. So why was globbing not dropped and regexes used
throughout? It seems that ksh93 supports "regex globbing". bash has
"extended globbing", but this seems a clumsy, bolted-on solution. Are
there shells out there which follow a regex-only approach (of this would
be non-POSIX)?

Happy for any further insights (technical or historical) shed on this
topic!

Axel

Date Sujet#  Auteur
21 Jul 24 * Globbing versus regular expressions10Axel Reichert
21 Jul 24 +- Re: Globbing versus regular expressions1Janis Papanagnou
21 Jul 24 +- Re: Globbing versus regular expressions1Joerg Mertens
21 Jul 24 +- Re: Globbing versus regular expressions1Kaz Kylheku
21 Jul 24 +- Re: Globbing versus regular expressions1Lawrence D'Oliveiro
2 Aug 24 +* Re: Globbing versus regular expressions2Ed Morton
5 Aug 24 i`- Re: Globbing versus regular expressions1Keith Thompson
2 Aug 24 `* Re: Globbing versus regular expressions3Ed Morton
10 Aug 24  `* Re: Globbing versus regular expressions2Axel Reichert
10 Aug 24   `- Re: Globbing versus regular expressions1Lawrence D'Oliveiro

Haut de la page

Les messages affichés proviennent d'usenet.

NewsPortal