如何展开RFC 822

时间:2010-11-19 17:39:32

标签: php rfc822 unfold

我正在尝试编写一个vCard Parser,并且在展开行时遇到问题。 正如您在此处所见:http://www.faqs.org/rfcs/rfc822.html寻找“展开”它表示以下所有内容都有效:

Long string<return>
<tab>continue

Long string<return>
<tab>(n*<tab>)continue

Long string<return>
<space>continue

Long string<return>
<space>(n*<space>)continue

我如何展开这个?这有正则表达式吗?我正在使用PHP,如果已经编写了一个类,我将使用它:)

1 个答案:

答案 0 :(得分:2)

你可以用它来删除那些折叠:

$output = preg_replace('/\r\n(?:[ \t]+)/', '', $input);