How to do unfolding RFC 822

匿名 (未验证) 提交于 2019-12-03 02:03:01

问题:

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 stringcontinue  Long string(n*)continue  Long stringcontinue  Long string(n*)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); 


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