Re: [DOC] Incomplete explanation about the regex =~ operator
From:
Chet Ramey
Subject:
Re: [DOC] Incomplete explanation about the regex =~ operator
Date:
Wed, 9 Jan 2019 15:37:10 -0500
User-agent:
Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:60.0) Gecko/20100101 Thunderbird/60.4.0
On 1/9/19 2:27 PM, kevin wrote:
> My message was poorly formatted (I lack of experience) and consequently you
> misunderstood it.
> The shell operation is unusual when a regular expression appears inside a
> conditional expression. Indeed, neither the Bash man page or the Bash
> Reference Manual indicates that the shell quotes some characters internally
> (Bash FAQ: http://git.savannah.gnu.org/cgit/bash.git/tree/doc/FAQ#n1927).
"Any part of the pat-
tern may be quoted to force the quoted portion to be matched as
a string."
> Moreover, the explanation in the Bash FAQ is unclear; it lacks examples to
> know when "an interference" occurred.
What is "an interference"?
> Look at the following answer to get an overview of the issue:
>https://stackoverflow.com/a/12696899
That answer is correct: bash uses the C library's regexp library and
only guarantees that POSIX EREs work.
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU chet@case.edu http://tiswww.cwru.edu/~chet/