Hai need help regarding this one:
I think the problem is with the $pattern2, I am not knowing the format to write it!! Can anyone help me please
This is the code, my task is to pull out the values of the report type stired in the file: They are stored like this:
username ~false./true.report type1~false./true.report type2.......etc
the report type will be added to a file with a false or true before it depending on user selection in previous step.
Code:
$pattern2 = "/^([-\w]{".PERM_TYPE_SEPARATOR."})\s(false.|true.)\s(.*)$/";
if(preg_match_all($pattern2, $entry2, $match))
{
echo "this one is called too";
for($i = 0; $i < count($match[1]); $i++)
{
echo "This one";
//if($match[1][$i] == "true.")
echo $match[2][$i];
}
//echo "123";
//$metadata[$matches[1][$i]] = $matches[2][$i];
}
Value of $entry2 at the time of execution
Code:
string '~false.123~false.45678~false.67890~false.123456~false.Hai testing~false.I am good~false.Now this should work~false.Plug'... (length=1223)
This is the result I am getting
Code:
$match =array
0 =>
array
empty
1 =>
array
empty
2 =>
array
empty
3 =>
array
empty
This is the text file I am actually parsong:
admin ~false.123~false.45678~false.67890~false.123456~fa lse.Hai testing~false.I am good~false.Now this should work~false.Second time~false.Test~false.Testing Parsed list~false.Testing reports~false.Testing settings~false.abcd~false.abcdef~false.hai how are you~true.sawraasdagweagsd~true.tested~true.tested2 ~true.testing~true.testing code again~true.testing code again 2~true.testing code now~true.testing it again~true.testing new report~true.third one~false.ujruesszerhqwrqhwer