split_by(
input,pattern,ltrim,rtrim) ->segments
Split a string by a pattern into tagged segments
Returns an array of segments, each with t ("reg" or "cap") and c
(content) fields. Captured segments match the pattern; regular segments
are the text between captures.