$re = '/^(?=(.{0,1500}language[^\n]*\n[^\n]*\n[^\n]*))(?=(.{0,1500}experience[^\n]*\n[^\n]*\n[^\n]*))(?=(.{0,1500}acquire[^\n]*\n[^\n]*\n[^\n]*))/ms';
$str = 'materials the in the case of language
what was taken further than assumed sort
of again though experiments but seems
obvious is that the basic elements
of language say concepts or words if
there\'s any difference between them
those must be primarily generated
internally their complexity and richness
is such that they can\'t possibly be
acquired from experience they were what
were called the common notions or innate
ideas formed by some internal generative
process that\'s structured in some
fashion this and there was a good but
about how this is done suggesting that
what\'s involved is you start with but
are now called gustave properties
notions of casual relation notions of
agency anthropomorphic perspectives all
familiar with the way we perceive and
think about the natural world
so you see you you talk about a comet as
aiming towards the Earth and fortunately
';
preg_match_all($re, $str, $matches, PREG_SET_ORDER, 0);
// Print the entire match result
var_dump($matches);
Please keep in mind that these code samples are automatically generated and are not guaranteed to work. If you find any syntax errors, feel free to submit a bug report. For a full regex reference for PHP, please visit: http://php.net/manual/en/ref.pcre.php