Home| Design| License| Regex| Download| Credits| Contact
Text-Zap Info
› Overview› Text-Zap Ant Task› Expand Text-Zap› API Docs
› Filters› Savers› Groupers› Sequencers
› Append Filter› Append File Filter› Extract Lines Filter› Find Filter› Insert References› Merge Filter› Replace Filter› Replace List Filter› Replace Filter Plus› Reverse Filter› Split By Regex Filter› XSLT Filter

Split By Regex Filter

The split by regex filter breaks a file into several smaller ones after each occurrence of the supplied regex.

Each new file will have the name of the original file with a number appened before the files extension. The first number is specified by the count parameter.

The concept of this filter is very simple but there are many details that can effect its behavior. Therefore there are many options availabe as described in the parameter list below.


regexthe regex to be searched forYes
countthe first number to be used to name the new filesNo, defaults to 1
endStringa string added to the file name between the original name and the 'count' number No, defaults to "" (empty string)
saveHeaderAlonesaves the header in it a separate file (the header refers to all text found before the first regex occuranceNo, defaults to false
repeatHeaderInEachFileflag indicating that the header text should be placed at the beginnig of each newly created fileNo, defaults to false
cutBeforeflag indicating that the split should be performed before the occurance of the regex as apposed to after the regexNo, defaults to true (has no effect when dropRegexText is true)
dropRegexTextflag indicating that the regex should be dropped and should not appear in any of the new filesNo, defaults to false


Splits every time the words 'new file' are found
 <splitByRegex regex="new file"/>
Splits every time the words 'new file' are found and the new file names start with 10
 <splitByRegex regex="new file" count"10" endString="--"/>
Splits every time the words 'new file' are found but drops the words 'new file' and the header will be saved separately
 <splitByRegex regex="new file" dropRegexText="true" saveHeaderAlone="true"/> 	
Splits every time the words 'new file' are found the words 'new file' will appear at the end of each file
 <splitByRegex regex="new file" cutBefore="false"/> 	
Splits every time the words 'new file' are found the words 'new file' the beginning of each file and the header will be repeated in each file
 <splitByRegex regex="new file" cutBefore="true" repeatHeaderInEachFile="true"/> 	
SourceForge.net Logo