Regexp match bug in grep(1)

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Regexp match bug in grep(1)

Steffen Nurpmeso-2
Hello,

the snippet

  cat <<_EOT |grep '\(POSIX\|C\|en_\(US\|GB\)\)\.\(UTF-8\|utf8\)'
  C
  en_US.utf8
  en_US.UTF-8
  POSIX
  _EOT

does not match on OpenBSD (the extended one does correctly).
Ciao,

--steffen
|Soylent Green is people!

Reply | Threaded
Open this post in threaded view
|

Re: Regexp match bug in grep(1)

Ingo Schwarze
Hi,

Steffen Nurpmeso wrote on Tue, May 02, 2017 at 10:04:06PM +0200:

> the snippet
>
>   cat <<_EOT |grep '\(POSIX\|C\|en_\(US\|GB\)\)\.\(UTF-8\|utf8\)'
>   C
>   en_US.utf8
>   en_US.UTF-8
>   POSIX
>   _EOT
>
> does not match on OpenBSD

Not a bug.

From re_format(7):

  BASIC REGULAR EXPRESSIONS
    Basic regular expressions differ in several respects:
      o  `|', `+', and `?' are ordinary characters and there is no
         equivalent for their functionality.

Yours,
  Ingo

Reply | Threaded
Open this post in threaded view
|

Re: Regexp match bug in grep(1)

Steffen Nurpmeso-2
Ingo Schwarze <[hidden email]> wrote:
 |Steffen Nurpmeso wrote on Tue, May 02, 2017 at 10:04:06PM +0200:
 |> the snippet
 |>
 |>   cat <<_EOT |grep '\(POSIX\|C\|en_\(US\|GB\)\)\.\(UTF-8\|utf8\)'
 |>   C
 |>   en_US.utf8
 |>   en_US.UTF-8
 |>   POSIX
 |>   _EOT
 |>
 |> does not match on OpenBSD
 |
 |Not a bug.
 |
 |>From re_format(7):
 |
 |  BASIC REGULAR EXPRESSIONS
 |    Basic regular expressions differ in several respects:
 |      o  `|', `+', and `?' are ordinary characters and there is no
 |         equivalent for their functionality.

Thanks for the correction, your are absolutely right.
So i am left all alone.  The Solaris "bug" is covered by C, even
though BSD and Linux show different behaviour, as Jörg Schilling
pointer out correctly.  Good night.

--steffen
|Soylent Green is people!