I Hugo, I do not use regex in plan9, but about the question:
> But then, how exactly the '?' operator is useful for grep? I was > thinking that it was good to filter lines that contain more characters > that desired, but it is not. In PERL, for example, you can do something like: ^a$ where ^ is start of line and $ end of line. For example, for lines with 8 characters and the ? operator: ^????????$ Saludos. On Wed, Jun 3, 2009 at 4:56 PM, hugo rivera <uai...@gmail.com> wrote: > Hello, > I am experimenting with some regexp implementations (namely the one > from "the practice of programming") and I am a little disoriented by > the use of the '?' operator in plan 9's grep: > say I have the following input > > aaaabbb > ab > aaaab > bb > b > aaabb > aaaa > > which I feed into grep with > > grep 'a+bb?' > > which should match at least one 'a' followed by one or two 'b'. So, > grep's output is > > aaaabbb > ab > aaaab > aaabb > > which really surprised me at first, since I wasn't expecting the first > line. After some thought, I realized that the 'aaaab' and the 'aaaabb' > patterns, contained in the first line of input, match the regexp, so > grep prints the line. > But then, how exactly the '?' operator is useful for grep? I was > thinking that it was good to filter lines that contain more characters > that desired, but it is not. > Saludos > -- > Hugo > > -- Rodolfo GarcĂa "kix" EA4ERH - IN80ER