I just want to find ALL elements with preg_match_all in a html document. After reading the file i am using the following:
preg_match_all('<.*style=?.*>',$file,$patterns);
print_r( $patterns[0] ); die;
Gives all the elements but with spacing and other stuff before the < and >. Also the output has an end tag in the result (for example: '). I have play around with preg expressions but drives me insane. Can somebody tell me what is the correct syntax to use?
The output is now:
Array
(
[0] => <table style="position:absolute;width:100%;height:100%;">
[1] => <div class="_barcode_pdf417" style="margin:0 auto;width:176px;height:132px;background:#FFF;color:#000;"><div style="margin:0 auto;margin:0;padding:0;border:0">
[2] => <div style="position:absolute;width:14px;height:128px;background:#000;"></div>
[3] => <div style="position:absolute;margin-left:18px;width:2px;height:128px;background:#000;"></div>
[4] => <div style="position:absolute;margin-left:22px;width:2px;height:128px;background:#000;"></div>
[5] => <div style="position:absolute;margin-left:26px;width:2px;height:128px;background:#000;"></div>
........
........
........
But i want:
Array
(
[0] => <table style="position:absolute;width:100%;height:100%;">
[1] => <div class="_barcode_pdf417" style="margin:0 auto;width:176px;height:132px;background:#FFF;color:#000;">
<div style="margin:0 auto;margin:0;padding:0;border:0">
[2] => <div style="position:absolute;width:14px;height:128px;background:#000;">
[3] => <div style="position:absolute;margin-left:18px;width:2px;height:128px;background:#000;">
[4] => <div style="position:absolute;margin-left:22px;width:2px;height:128px;background:#000;">
[5] => <div style="position:absolute;margin-left:26px;width:2px;height:128px;background:#000;">
......
......
Thank you for your answer! Kind regards.