I want to take a long string, made up of several paragraphs and put the first paragraph, unless it's shorter than a given pareameter, into a new string.
I've tried using ereg_replace:
$mySubstring = ereg_replace("^(.{$length}.*$).*", "\\1",$longstring );
I reckon this should work but it doesn't
The first parenthesis should make \1 the first paragraph (or paragraphs if it's really short)
The next bit should allow the rest of the text to be disregarded.
So why doesn't it work?
^ new line
.{$length} $length of any characters
.*any number of any characters
$ end of line