PHP正则表达式以特定的方式解析HTML [英] PHP regular expression to parse HTML in a specific way
本文介绍了PHP正则表达式以特定的方式解析HTML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Possible Duplicate:
How to parse and process HTML with PHP?
我有以下HTML:
I have the following HTML:
<Text><strong>Cancellation</strong>
A cancellation is free of charge possible until 6PM on arrival day. With later cancellation or no arrivals without previous cancellation the hotel is justified to place 90% of the booked achievements (excl. breakfast) in calculation whereby the amount at a value of USD 500.00 is not exceeded.
<strong>Check-in time</strong>
Starting from 15:00
<strong>Check-out time</strong>
Until 12:00
<strong>Guarantee</strong>
No guarantee required.</Text>
我想解析它并将其存储在数组中,例如:
and I want to parse it and store in an array for example like this:
array(
'Cancelation' => 'A cancellation is free of charge possible until 6PM on arrival day. With later cancellation or no arrivals without previous cancellation the hotel is justified to place 90% of the booked achievements (excl. breakfast) in calculation whereby the amount at a value of USD 500.00 is not exceeded.',
'Check-in time' => 'Starting from 15:00',
'Check-out time' => 'Until 12:00',
'Guarantee' => 'No guarantee required.'
);
预先感谢您的提示。
Thank you for the hints in advance.
推荐答案
阅读这个教程,不需要使用饥饿的正则引擎。
Read this tutorial, no need to use hungry regex engine.
这篇关于PHP正则表达式以特定的方式解析HTML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文