Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > gnu.bash.bug > #14313

Re: Word boundary anchors \< and \> not parsed correctly on the right side of =~

From Chet Ramey <chet.ramey@case.edu>
Newsgroups gnu.bash.bug
Subject Re: Word boundary anchors \< and \> not parsed correctly on the right side of =~
Date 2018-07-10 10:47 -0400
Message-ID <mailman.3375.1531234040.1292.bug-bash@gnu.org> (permalink)
References <5b440fe8.1c69fb81.948f6.4d1e@mx.google.com> <20180710122718.wrrzjuqpmpns4o4o@eeg.ccf.org> <d183b912-bcd6-fd78-23e6-1dd7c3cb6d20@iki.fi>

Show all headers | View raw


On 7/10/18 8:52 AM, Ilkka Virta wrote:
> On 10.7. 15:27, Greg Wooledge wrote:
>> On Mon, Jul 09, 2018 at 10:46:13PM -0300, marcelpaulo@gmail.com wrote:
>>> Word boundary anchors \< and \> are not parsed correctly on the right
>>> side of a =~ regex match expression.
>>
>> Bash uses ERE (Extended Regular Expressions) here.  There is no \< or \>
>> in an ERE.
> 
> Or does it use the system's regex library, whatever that supports?

It uses the POSIX regular expression API (regcomp/regexp/regerror/regfree)
if the system's libc supports it. Since it uses the POSIX interfaces, it
assumes nothing beyond the POSIX definition of EREs.

> If '\<' matches just a regular less-than sign (but has a useless
> backslash), then surely that should not match?

A system's libc can provide extensions. Bash can't assume anything about
them. That's why this matches on Linux, but not Mac OS X.

-- 
``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/

Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread


Thread

Re: Word boundary anchors \< and \> not parsed correctly on the right side of =~ Chet Ramey <chet.ramey@case.edu> - 2018-07-10 10:47 -0400

csiph-web