How to do unfolding RFC 822

早过忘川 提交于 2019-11-28 10:47:33

问题


I am trying to write a vCard Parser and am having trouble unfolding lines. As you can see here: http://www.faqs.org/rfcs/rfc822.html look for "unfolding" it says that all the following are valid:

Long string<return>
<tab>continue

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

Long string<return>
<space>continue

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

How do I unfold this? Is there a regex for this? I am using PHP if a class has been written I will use that :)


回答1:


You could use this to remove those foldings:

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


来源:https://stackoverflow.com/questions/4227783/how-to-do-unfolding-rfc-822

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!