in reply to Matching positions with lookarounds

Take a look at Text::Wrap.
  • Comment on Re: Matching positions with lookarounds