I have this specific line of text and clients submit, and the line automatically breaks at 65 characters and i need to modify my regular expression to look for one more additional line, return carriages or new line characters up until the first punctuation mark such as .,!,?
An example of the line being matched.:
Snippet: It's time again for the Annual State Marching Event, This Saturday at 5pm.
The above line exceeds 65 characters, and sometimes the lines are broken like this
Snippet: It's time again for the Annual State Marching Event, This
Saturday at 5pm.
Which appears as Event, This\r\n
This is the regexp i use:
preg_match('/Snippet:(\s)?+(.*)\./i', $html_part, $matches) ? $matches[2] : '';
I’ve tried on my won to escape the punctuation marks, but no luck.
Any help would be appreciated. Thanks in advance.
Try the
smodifier, like so:Source
Demo