Subject: bug#52873: closed (Re: bug#52873: expr unexpected syntax error)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 29 Dec 2021 19:53:02 +0000

Your bug report

#52873: expr unexpected syntax error

which was filed against the coreutils package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
52873: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=52873
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#52873: expr unexpected syntax error
From: Paul Eggert <[email-masked]>
To: Davide Brini <[email-masked]>
Cc: Martin Rixham <[email-masked]>, [email-masked]
Date: Wed, 29 Dec 2021 11:52:25 -0800
List-Id: <debbugs-submit.debbugs.gnu.org>

On 12/29/21 08:31, Davide Brini wrote:
> I think you need to use '+' before the offending token

Yes. That's a GNU extension. If you want to be portable to any POSIX 
implementation, you can use this instead:

expr "X(" : '.*' - 1

A similar example is given in the POSIX spec for 'expr':

https://pubs.opengroup.org/onlinepubs/9699919799/utilities/expr.html

As this is not a bug, I'm closing the bug report.

Subject: expr unexpected syntax error
From: Martin Rixham <[email-masked]>
To: [email-masked]
Date: Wed, 29 Dec 2021 12:42:24 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

I'm getting an error from the following:

    [martin@fedora ~]$ expr ')' : '.*'
    expr: syntax error: unexpected ')'

There also seems to be a similar problem with:

    expr '(' : '.*'

Here's the version:

    [martin@fedora ~]$ expr --version
    expr (GNU coreutils) 8.32
    Copyright (C) 2020 Free Software Foundation, Inc.
    License GPLv3+: GNU GPL version 3 or later <
https://gnu.org/licenses/gpl.html>.
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.

    Written by Mike Parker, James Youngman, and Paul Eggert.

And a uname for good measure:

    [martin@fedora ~]$ uname -a
    Linux fedora 5.15.7-200.fc35.x86_64 #1 SMP Wed Dec 8 19:00:47 UTC 2021
x86_64 x86_64 x86_64 GNU/Linux

Thanks,

Martin