Reputation: 91
For example, my text is :
Block 1:
xxxxxx xxxx
xxxxxx xxxx
xxxxxx xxxx
Block 2:
xxxxxx xxxx
xxxxxx xxxx
xxxxxx xxxx
Block 3:
xxxxxx xxxx
xxxxxx xxxx
xxxxxx xxxx
I want to split the by the different blocks, in tcl. E.g:
{Block 1:
xxxxxx xxxx
xxxxxx xxxx
xxxxxx xxxx}
{Block 2:
xxxxxx xxxx
xxxxxx xxxx
xxxxxx xxxx}
{Block 3:
xxxxxx xxxx
xxxxxx xxxx
xxxxxx xxxx}
Any way to make this work? Thanks!
Upvotes: 0
Views: 143
Reputation: 7257
Try the tcllib `textutil::splitx`` command. (see http://core.tcl.tk/tcllib/doc/trunk/embedded/www/tcllib/files/modules/textutil/textutil.html#8)
It can split text based on a regular expression.
Upvotes: 2