Hi all
I really hope someone can help me with this. I've been trying to solve it for hours but I am not getting anywhere.
I have the following text in a file:
<?php
/***** BEGIN *****/
debug = 2
timelimit = 1500
charset = UTF8
categories =
"9"=>"01"
"2"=>"07"
"36"=>"25"
"23"=>"10"
"30"=>"10,11"
"13"=>"25"
"6"=>"14"
"34"=>"02"
"15"=>"26"
"31"=>"12"
"03"=>"12"
"33"=>"13"
"22"=>"15"
"14"=>"05"
"12"=>"04"
"35"=>"19"
"38"=>"06"
"10"=>"06"
"7"=>"29"
"20"=>"12"
"29"=>"12"
"11"=>"03"
"4"=>"16"
"5"=>"20"
"24"=>"21"
"1"=>"21"
"17"=>"18"
"28"=>"08,09"
"25"=>"22"
"18"=>"27"
"27"=>"28"
"16"=>"23"
"32"=>"24"
joblist = <td align=\"left\" width=\"8%\" valign=\"top\" class=\"Body-Textdate\">.*<\/td><td .*><a href=\"([^\"]+)\" class=\"Body-Textlarge2\">([^<]+)<\/a><\/td><td .*>.*<\/td><td .*>.*<\/td>
/***** END *****/
?>
Note the third last line is a regular expression...
I read the contents of the file into a variable called $contents.
I then want to use a regular expression to select all the text between the BEGIN/END comments, so I am using the following:
preg_match_all("/\/\*\*\*\*\* BEGIN \*\*\*\*\*\/\s*(.*)\s*\/\*\*\*\*\* END \*\*\*\*\*\//U",$contents,$found);
This works fine if I test it using a website like http://www.regexpal.com, but for some reason it won't work in my code. If remove the third last line (the regular expression) it works fine, so obviously this is the troublesome line.
Does anyone know a way I can successfully select everything between the comments?
Thanks for reading.