Re: Globbing versus regular expressions

Liste des GroupesRevenir à cu shell 
Sujet : Re: Globbing versus regular expressions
De : ldo (at) *nospam* nz.invalid (Lawrence D'Oliveiro)
Groupes : comp.unix.shell
Date : 21. Jul 2024, 22:29:31
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <v7jujr$8pms$2@dont-email.me>
References : 1
User-Agent : Pan/0.158 (Avdiivka; )
On Sun, 21 Jul 2024 09:01:18 +0200, Axel Reichert wrote:

Since regexes are (at quick glance) a superset of globs, why not
consistently use the former for both file names and strings?

I would guess:

1) Historical reasons; I would say wildcards originated before regexes.
2) Issues with syntax: for example, dots mean “any character” in a regex,
   while they occur quite commonly in filenames, and having to escape them
   all the time would be a pain.
3) Simplicity. Wildcards are much more limited than regexes, but they
   are convenient for a lot of common cases.

Also, regexes have evolved a lot over time. They were considered fairly
exotic at the time of the origin of tools like awk or sed, and also they
varied quite a lot in syntax and capabilities. I would credit the coming
of Perl with popularizing the idea in quite a powerful form--so powerful
that “Perl-Compatible Regular Expression” (“PCRE”) has become the closest,
I think to a de-facto standard for how regexes should work.

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