in reply to Regex: get first N characters but break at whitespace

Look-ahead is your friend. ($chunk) = /^(.{1,200})(?<!\s)(?!\w)/; That matches as many (up to 200) characters, such that the last character is NOT whitespace, and the next character is NOT a word character.

_____________________________________________________
Jeff[japhy]Pinyan: Perl, regex, and perl hacker.
s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;