Help with preg_match - really stuck :(
Posted: Sun May 16, 2004 12:33 pm
Hi
I am really stuck with preg_match to retreive a value and then use it to be calculated etc.
Here is my code:
preg_match("/<font face=\"Arial,sans-serif\" size=2 color=E8E8E8>(.+)<\/td>/is",$line,$matches); echo $matches[1];
This grabs the number within (.+) ok but sometimes this will be text. How can i ignore occurrences that contain text?
also, i want to use $matches[1] in a calculation but im having no luck - is it the [1] that is causing the problem.
eg i am trying $variable = $matches[1] + $matches[1];
....but no joy
please excuse me, because as you can tell, ima relative noob
i would be grateful if anyone could help?
I am really stuck with preg_match to retreive a value and then use it to be calculated etc.
Here is my code:
preg_match("/<font face=\"Arial,sans-serif\" size=2 color=E8E8E8>(.+)<\/td>/is",$line,$matches); echo $matches[1];
This grabs the number within (.+) ok but sometimes this will be text. How can i ignore occurrences that contain text?
also, i want to use $matches[1] in a calculation but im having no luck - is it the [1] that is causing the problem.
eg i am trying $variable = $matches[1] + $matches[1];
....but no joy
please excuse me, because as you can tell, ima relative noob
i would be grateful if anyone could help?