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


Groups > gnu.bash.bug > #15405 > unrolled thread

Regular Expression matching operation =~

Started byAllodoxaphobia <trepidation@example.net>
First post2019-09-22 21:44 +0000
Last post2019-09-22 21:44 +0000
Articles 1 — 1 participant

Back to article view | Back to gnu.bash.bug

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Regular Expression matching operation =~ Allodoxaphobia <trepidation@example.net> - 2019-09-22 21:44 +0000

#15405 — Regular Expression matching operation =~

FromAllodoxaphobia <trepidation@example.net>
Date2019-09-22 21:44 +0000
SubjectRegular Expression matching operation =~
Message-ID<mailman.826.1569200533.2190.bug-bash@gnu.org>
In moving a bash ver. 4.3.48 (Ubuntu) program to a bash ver. 5.0.11 
(FreeBSD) environment I encountered either a bug, a quirk, or 
an undocumented feature.

I was using a null regexp as a "match for anything" case when an
optional command line parameter (a test pattern) was omitted.

I boiled down what I was experiencing to 

$ bash -version
GNU bash, version 4.3.48(1)-release (x86_64-pc-linux-gnu)
$ [[ "String" =~ "ring" ]] ; echo $?
0
$ [[ "String" =~ "" ]] ; echo $?
0
$    

$ bash -version
GNU bash, version 5.0.11(0)-release (amd64-portbld-freebsd12.0)
$ [[ "String" =~ "ring" ]] ; echo $?
0
$ [[ "String" =~ "" ]] ; echo $?
2
$

A null regexp works Just Fine in both the Ubuntu and FreeBSD
environments. E.g.:

$ grep "" /etc/shells

Jonesy
-- 
  Marvin L Jones    | Marvin      | W3DHJ.net  | linux
   38.238N 104.547W |  @ jonz.net | Jonesy     |  FreeBSD
    * Killfiling google & XXXXbanter.com: jonz.net/ng.htm

[toc] | [standalone]


Back to top | Article view | gnu.bash.bug


csiph-web