daneharnett
Programmer
Hi everyone,
im trying to use ereg() to match a pattern in a string.
my pattern is "(.*) (.*)"
my string is "foreach ($x as $i)"
basically i would like to get the first string up until the first 'space' char..
when i ereg these via
ereg($pattern, $string, $matches);
$matches[1] = "foreach ($x as";
i want it to only be "foreach";
can anyone help?
im trying to use ereg() to match a pattern in a string.
my pattern is "(.*) (.*)"
my string is "foreach ($x as $i)"
basically i would like to get the first string up until the first 'space' char..
when i ereg these via
ereg($pattern, $string, $matches);
$matches[1] = "foreach ($x as";
i want it to only be "foreach";
can anyone help?