lkml.org 
[lkml]   [1997]   [Feb]   [12]   [last100]   RSS Feed
Views: [more markup]  [less markup]  [headers]  [forward] 
 
Messages in this thread
/
DateWed, 12 Feb 1997 15:46:35 -0800
From(Noah Friedman)
SubjectRe: sh-utils expr 1.15 regexp bug
>> It used to be the case that the expression
>> 
>>     expr 100 : '0$\|-?[1-9][0-9]*'
>> 
>> Would print 3.  This worked with sh-utils 1.12.
>> 
>> With 1.15, it prints 0 unless I remove "-?" from the regexp, or replace it
>> with `*', which isn't exactly right.
>> 
>> Isn't `?' a part of the old grep syntax for matching the preceding
>> character or group 0 or 1 times?  Was this functionality removed
>> deliberately?  It's breaking the linux kernel configuration scripts.
>
>I've experienced this too...It affects two lines in Menuconfig only.  The
>reply given me by the maintainer of sh-utils was to add a "\" before the ?
>as suggested in the other reply to your post.

Yes, but then people with older versions of expr will lose, because \? will
be interpreted as a normal character.

For portability, I think we may be resigned to using

       expr $value : '0\|-[1-9][0-9]*\|[1-9][0-9]*'
\
 
 \ /
  Last update: 2005-03-22 13:38    [W:0.228 / U:0.110 seconds]
©2003-2008 Jasper Spaans