如何从PHP文本中删除空白行?

如何从PHP文本中删除空白行?,第1张

如何从PHP文本中删除空白行?
// New line is required to split non-blank linespreg_replace("/(^[rn]*|[rn]+)[st]*[rn]+/", "n", $string);

上面的正则表达式说:

/(^[rn]*|[rn]+)[st]*[rn]+/    1st Capturing group (^[rn]*|[rn]+)        1st Alternative: ^[rn]*        ^ assert position at start of the string [rn]* match a single character present in the list below     Quantifier: Between zero and unlimited times, as many times as possible, giving back as needed [greedy]     r matches a carriage return (ASCII 13)     n matches a fine-feed (newline) character (ASCII 10)        2nd Alternative: [rn]+ [rn]+ match a single character present in the list below Quantifier: Between one and unlimited times, as many times as possible, giving back as needed [greedy] r matches a carriage return (ASCII 13) n matches a fine-feed (newline) character (ASCII 10)    [st]* match a single character present in the list below        Quantifier: Between zero and unlimited times, as many times as possible, giving back as needed [greedy]        s match any white space character [rntf ]        tTab (ASCII 9)    [rn]+ match a single character present in the list below        Quantifier: Between one and unlimited times, as many times as possible, giving back as needed [greedy]        r matches a carriage return (ASCII 13)        n matches a fine-feed (newline) character (ASCII 10)


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/4935699.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-11-13
下一篇 2022-11-13

发表评论

登录后才能评论

评论列表(0条)

保存