> Something like this -
> "foo".(0,+) "bar" would match zero or more occurrences of "foo" followed
> by "bar". So, it would match "foo" , "foo" "bar", "foo" "bar" "bar" ...
> and so on.
> 
> "foo".(0,1) "bar" would match zero or one occurrences of "foo" followed
> by "bar".

Are you talking about regular expression syntax?

  (foo){0,}(bar){1,}         # or (foo)?(bar)+
  (foo){0,1}bar              # or (foo)?bar

See http://www.ruby-doc.org/docs/ProgrammingRuby/html/language.html#UL

Otherwise, if you are writing a parser for some language of your own 
devising, then you are free to implement whatever syntax you wish. Buy a 
good book on language and compiler design.
-- 
Posted via http://www.ruby-forum.com/.