Re: Does libtool need to escape plus signs in egrep expressions?

Bob Friesenhahn <[email protected]>
Newsgroups gmane.comp.gnu.libtool.general
Message-ID <[email protected]>
On Thu, 28 Jun 2018, Roumen Petrov wrote:
> May be I misunderstand issue.
>
> $ echo ' _head_ABC_a'  | egrep ' _head_[A-Za-z0-9_]+_[ad]l*$'
>  _head_ABC_a
>
> $ echo ' _head_ABC_al'  | egrep ' _head_[A-Za-z0-9_]+_[ad]l*$'
>  _head_ABC_al
>
> but:
> $ echo ' _head__al'  | egrep ' _head_[A-Za-z0-9_]+_[ad]l*$'
> $ echo ' __head_ABC_al'  | egrep ' _head_[A-Za-z0-9_]+_[ad]l*$'
> $ echo ' _head_ABC_zl'  | egrep ' _head_[A-Za-z0-9_]+_[ad]l*$'
>
>
>
>> Are you sure this actually works?
> I'm not expert in regular expressions but according above tests "plus" in RE 
> works - see case _head__al .

It should match a run of alpha-numeric characters including 
underscores.  However, I do see that the expression includes a match 
of literal underscore and then there is a literal underscore so there 
might be something going on with that.  Greedy matching would likely 
absorb a final underscore so it might not be possible to match on that 
final literal underscore.  This might expose differences in behaviors 
between egreps.

Bob
-- 
Bob Friesenhahn
[email protected], http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer,    http://www.GraphicsMagick.org/

_______________________________________________
https://lists.gnu.org/mailman/listinfo/libtool
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.