I have this data in a LONGTEXT column (so the line breaks are retained):
Paragraph one
Paragraph two
Paragraph three
Paragraph four
I'm trying to match paragraph 1 through 3. I'm using this code:
preg_match('/Para(.*)three/', $row['file'], $m);
This returns nothing. If I try to work just within the first line of the paragraph, by matching:
preg_match('/Para(.*)one/', $row['file'], $m);
Then the code works and I get the proper string returned. What am I doing wrong here?
Use s
modifier.
preg_match('/Para(.*)three/s', $row['file'], $m);
http://php.net/manual/en/reference.pcre.pattern.modifiers.php