On 8/21/18 1:25 AM, Greg Troxel wrote:
> 
> "Regina Obe" <l...@pcorp.us> writes:
> 
>> I asked Sebastian the same thing.  He said it's needed in configure
>> script to escape the [] as I recall.
> 
> Of course :-) I was looking back and forth in so many rules I forgot
> which it was.
> 
> But, I figured out what was wrong.  This is the version from configure
> (so no extra [ - don't paste it in...).    The key thing is to add ()
> around .* before the ?, because
> 
>   .*?
> 
> is malformed.   It's the .* production that the ? applies to (present or
> not).
> 
>   VERSION_RELEASE=`echo "$VERSION" | sed -E 
> 's/^([0-9]+\.[0-9]+\.[0-9]+)(.*)?$/\1/'`
> 
> GNU sed may be allowing this as an extension, because "*?" doesn't make
> sense, since * is repetition.

Note the -E option for extended regular expressions which came from GNU
sed but is now included in POSIX.

The ? should make the .* expression non-greedy.

> Actually, the whole ? is redundant and can be just dropped, because
> 
>   (.*)?
> 
> matches zero or more occurrences fo any character, and also the empty
> string.  But .* matches the empty string anyway.  So while I can see the
> point that it leads the reader to think "either some arbitrary string or
> the empty string", it's just more complicated for no good reason.
> 
> So just drop the ? after the .*

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
geos-devel mailing list
geos-devel@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/geos-devel

Reply via email to