Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > gnu.bash.bug > #14308
| Path | csiph.com!goblin3!goblin2!goblin1!goblin.stu.neva.ru!usenet.stanford.edu!not-for-mail |
|---|---|
| From | Ilkka Virta <itvirta@iki.fi> |
| Newsgroups | gnu.bash.bug |
| Subject | Re: Word boundary anchors \< and \> not parsed correctly on the right side of =~ |
| Date | Tue, 10 Jul 2018 15:52:22 +0300 |
| Lines | 44 |
| Approved | bug-bash@gnu.org |
| Message-ID | <mailman.3367.1531227154.1292.bug-bash@gnu.org> (permalink) |
| References | <5b440fe8.1c69fb81.948f6.4d1e@mx.google.com> <20180710122718.wrrzjuqpmpns4o4o@eeg.ccf.org> |
| NNTP-Posting-Host | lists.gnu.org |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-Trace | usenet.stanford.edu 1531227154 29050 208.118.235.17 (10 Jul 2018 12:52:34 GMT) |
| X-Complaints-To | action@cs.stanford.edu |
| Cc | marcelpaulo@gmail.com, bug-bash@gnu.org, bash@packages.debian.org |
| To | Greg Wooledge <wooledg@eeg.ccf.org> |
| Envelope-to | bug-bash@gnu.org |
| User-Agent | Mozilla/5.0 (Macintosh; Intel Mac OS X 10.11; rv:52.0) Gecko/20100101 Thunderbird/52.9.0 |
| In-Reply-To | <20180710122718.wrrzjuqpmpns4o4o@eeg.ccf.org> |
| Content-Language | en-US |
| X-SASI-RCODE | 200 |
| DKIM-Signature | v=1; a=rsa-sha256; c=relaxed/relaxed; d=iki.fi; h=subject:to:references:from:cc:message-id:date:mime-version:in-reply-to:content-type:content-transfer-encoding; s=smtp; bh=MvG1Ou1QBcKTMYXKmgwSEMDWFm3k2r/m+NZOtklUNME=; b=jA6JnQua9HhL0u9rvDGYeptguJIZXOBsIHnhhebmIqxOaIaeH3gwaX4AEq4DrR6JYie82l0bnOs24f7YJqdkCapvMV0qEo31qj6UOB2RGx2v3JJXicKnzgn8dOVRecDQzHhiRaGe8oOiPurkC2xRILkh/Ao+F3+kfcuiopGBT2imjmjMQJdjyQqjAOTR1toxIDkSSkNhxUiTsSuAiXbDoknrsUtu6LxYLRRTwC4xyUcZQVstOw/D/j3GX5Q3bh3+8eh2nIKbGSzYw9EFGF3rDBzj/IMICzJnWzoYBS2l7JYcOma+KJFJk2XJJdcsfobE7oFNgBszjmsFH6D6wcrIdg== |
| X-detected-operating-system | by eggs.gnu.org: FreeBSD 8.x [fuzzy] |
| X-Received-From | 157.24.2.104 |
| X-BeenThere | bug-bash@gnu.org |
| X-Mailman-Version | 2.1.21 |
| Precedence | list |
| List-Id | Bug reports for the GNU Bourne Again SHell <bug-bash.gnu.org> |
| List-Unsubscribe | <https://lists.gnu.org/mailman/options/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=unsubscribe> |
| List-Archive | <http://lists.gnu.org/archive/html/bug-bash/> |
| List-Post | <mailto:bug-bash@gnu.org> |
| List-Help | <mailto:bug-bash-request@gnu.org?subject=help> |
| List-Subscribe | <https://lists.gnu.org/mailman/listinfo/bug-bash>, <mailto:bug-bash-request@gnu.org?subject=subscribe> |
| Xref | csiph.com gnu.bash.bug:14308 |
Show key headers only | View raw
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? On my Linux systems, this prints 'y' (with Bash 4.4.12 and 4.1.2): re='\<foo\>' ; [[ "foo bar" =~ $re ]] && echo y If '\<' matches just a regular less-than sign (but has a useless backslash), then surely that should not match? That's the same example marcelpaulo@gmail.com had, they didn't have the <> signs in the string. On my Mac, the above doesn't match. The same thing with a similar regex with \w . > http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap09.html#tag_09_04 > >> This evaluates as false: >> >> [[ 'foo bar' =~ \<foo\> ]] > > Well, of course it does, because \< is just a literal less-than sign > in a POSIX ERE. > > wooledg:~$ re='\<foo\>' > wooledg:~$ [[ '<foo>' =~ $re ]] && echo yes > yes > > You might as well remove the backslashes, because they serve no purpose > here. If you thought they meant "word boundary" or something, you're > in the wrong language. > -- Ilkka Virta / itvirta@iki.fi
Back to gnu.bash.bug | Previous | Next | Find similar | Unroll thread
Re: Word boundary anchors \< and \> not parsed correctly on the right side of =~ Ilkka Virta <itvirta@iki.fi> - 2018-07-10 15:52 +0300
csiph-web