On 9/20/19 8:12 PM, hk wrote:
> What is wrong is the description `zero or one instances of 'a''. But if we
> correct the right hand side word to beĀ `[[:space:]]*(a)?b' that it does
> match what the description says.(the parenthese around `a' could be omitted).
Yeah, that's the typo.
> I was also wrong saying it was a pattern instead of a regular expression.
> It is syntatically correct as a regular expression.
That's true. According to the POSIX ERE definition, the `?' is a special
ERE character in an invalid position (it's only special after a specifier
that matches a single character, not after a separate specifier that
matches multiple characters), so it matches itself.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, UTech, CWRU [email protected] http://tiswww.cwru.edu/~chet/