bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

is expr's \? regex metachar working?


From: Clark O. Morgan
Subject: is expr's \? regex metachar working?
Date: 23 Aug 2001 05:19:36 -0700

Forgive me if this is a dup post.  A previously posted copy of this article
hasn't shown up on aracnet's news server or on newsguy....


The info page for expr 2.0 says that with respect to the ':' operator's
regular expression argument:

     In the regular expression, `\+', `\?', and `\|' are operators
     which respectively match one or more, zero or one, or separate
     alternatives.

I can't get `\?' to work--it always seems to return
the length of the target string.....

$ ./expr --version
expr (GNU sh-utils) 2.0
Written by Mike Parker.

$ ./expr "abcdef" : '.*b'
2
$ ./expr "abcdef" : '.*u'
0
$ ./expr "abcdef" : '.*u\?'
6
$ ./expr "abcdef" : '.*b\?'
6                           <--- this looks wrong
$ ./expr "abcdef" : '.*z\?'
6
$ ./expr "abcdef" : '.*\(z\)\?'

$ ./expr "abcdef" : '.*\(b\)\?'
                           <--- this looks wrong




reply via email to

[Prev in Thread] Current Thread [Next in Thread]