Imagine an input string
aaaaabbccccceeebbbbbbbbbbeaaabaacccceeee...

I have regexp for the parts a,b,c
and e can be considered as else.

So how can I efficiently search/step through the string from left to
right, while calling for each section the fitting handler, kind of

case section
  /aaaa/ ...

  /bbb/  ...

  /cccc/ ..

  else

end


Thanks for ideas!
Martin