A
Anonymous
Guest
Hi,
I'm trying to parse what is effectively a just structured HTML comment (similar format to an SSI directive) and extract sections of it using a regular expression.
I'm trying to parse something like:
The regex should first of all validate that the format is correct and then extract the type and value.
The code I'm using is as follows.
If it worked, it would print:
I'm not very good with regular expressions. I'm trying to figure them out but just when I think I'm getting somewhere it all goes to pot and refuses to work.
I've simplified it down two two statements. The first one works, (i.e. returns some registers) the second fails.
Please help!
Thanks,
Matt
I'm trying to parse what is effectively a just structured HTML comment (similar format to an SSI directive) and extract sections of it using a regular expression.
I'm trying to parse something like:
Code:
The regex should first of all validate that the format is correct and then extract the type and value.
The code I'm using is as follows.
Code:
<?eregi("^$", "", $registers);
print_r($registers);
If it worked, it would print:
Code:
Array
(
[0] =>
[1] => type
[2] => value
)
I'm not very good with regular expressions. I'm trying to figure them out but just when I think I'm getting somewhere it all goes to pot and refuses to work.
I've simplified it down two two statements. The first one works, (i.e. returns some registers) the second fails.
Code:
<?eregi("^$", "", $registers);
print_r($registers);
Code:
<?eregi("^$", "", $registers);
print_r($registers);
Please help!
Thanks,
Matt