c:\@Work\Perl\monks>perl -wMstrict -le "$_ = 'The <A} test {B> sentence <C} foo {42} bar {D> baz'; ;; while (m{ \G .*? ({\d+} | {\w+> | <\w+}) }xmsg) { printf qq{'$1' }; } " '<A}' '{B>' '<C}' '{42}' '{D>'