![]() |
|
laziness, impatience, and hubris | |
PerlMonks |
comment on |
( #3333=superdoc: print w/replies, xml ) | Need Help?? |
bdimych,
any advice? Yes - stop trying to do this in a single regular expression. While I am sure there will be a dozen correct and working solutions provided, I doubt any will be self-documenting. I also suspect anyone maintaining your code will take pause when they come across it. Why not come up with a split_by_n() function where you can pass in a string and a length and get back what you want. Heck, you could then have optional parameters for what to do with empty strings, padding or not, etc. Cheers - L~R In reply to Re: How to split_and_pad string to n-th chars pieces with one regular expression?
by Limbic~Region
|
|