Splits a file based on tags of the form <$splitString> ...
Splits a file based on tags of the form <$splitString> ... </$splitString> and performs a function on each segment. If a tag is missing for whatever reason will treat the next tag (whether it is <$splitString> or </$splitString> as the delimiter of this segemnt.
file to be segmented
string that defines doc delimiting tags
passed in so that the regex does not have to be built with each call (should look like """</?splitString>""")
function to be called on each segment
size of readingBuffer