php - Regex to repair linebreaks of Google Calendar ICAL export -
i have been unlucky in trying repair google calendar's ical export. problem long description (field description) have linebreak containing these characters:
[first line] 0d 0a 20 [second line]
so that's carriage return \r, new line \n , simple space. i'm doing in php's preg_replace - why 1 not work?
$text = preg_replace('/\r\n\s/', '', $text);
thanks in advance.
edit:
the above regex works fine; problem somewhere else. background: wordpress plugin imports ical files. while reading ical file parsing removed newlines. layer 8 issue on behalf. everyone!
just record, not repairing google icalendar export rather dealing icalendar line folding. see http://tools.ietf.org/html/rfc5545#section-3.1
there other funkiness of icalendar face @ point. example, have @ http://tools.ietf.org/html/rfc5545#section-3.3.11
in other words, may want @ existing icalendar libraries alternative doing parsing yourself.
Comments
Post a Comment