in reply to Re: Re: PM Poster (util for ease of posting / reply)
in thread PM Poster (util for ease of posting / reply)
It would have been nice, if the following line worked (which would have made my code a lot simpler):split /\n{2,}/, $inputed_text;
I find that letting invisible spaces be significant causes lots of problems. This is one of them. Try:
It won't be defeated by trailing white-space (which is usually "invisible"), including cases of "\r\n", which you'll find is very common in multi-line text sent via HTTP (because that is what the standard says you are supposed to send, I believe).split /([^\S\n]*\n){2,}/, $input;
Note that [^\S\n] means 'any character that is not non-white-space nor "\n"', which can be reworded more clearly as 'any character that *is* white-space other than "\n"', which is a good way to match trailing white-space without risking sucking in the final "\n".
- tye("input" is not a verb so I refuse to write "inputted" much less "inputed")
|
|---|