bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Word boundary anchors \< and \> not parsed correctly on the right si


From: Chet Ramey
Subject: Re: Word boundary anchors \< and \> not parsed correctly on the right side of =~
Date: Tue, 10 Jul 2018 10:47:10 -0400
User-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:52.0) Gecko/20100101 Thunderbird/52.9.0

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/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]