Concatenate RTF files in PHP (REGEX)

后端 未结 2 340
离开以前
离开以前 2021-01-23 01:19

I\'ve got a script that takes a user uploaded RTF document and merges in some person data into the letter (name, address, etc), and does this for multiple people. I merge the le

相关标签:
2条回答
  • 2021-01-23 01:23

    To this I can say ick ick ick. Nevertheless, rcar's cludge probably will work, barring some weird edge-case where RTF doesn't actually end in that form, or the document-wide styles include important information that utterly messes up the formatting, or any other of the many failure modes.

    0 讨论(0)
  • 2021-01-23 01:30

    I would question the use of RTF in this case. It's not entirely clear to me what you're trying to do overall, so I can't necessarily suggest anything better, but if you can try to explain your project more broadly, maybe I can help.

    If this is really the way you want to go though, this regex gave me the correct output given your input:

    $output = preg_replace("/}\s?\n\\\\page.*?\\\\par\s?\n/ms", "\\page\n", $input);
    
    0 讨论(0)
提交回复
热议问题