Source texts (7):
- give 4 cars
- ga 5 cars
- GA 5 Cars @mustang six exhausts are necessary
- Give -1 Cars @mustang
- Give Cars @mustang
- Give 3 Cars @ford
- Give 5 Cars @cobra_gt
The ones which should be successful ate 1,2,3,6,7
preg_match('/Give (\d+) Cars @(\w+)|GA (\d+) Cars @(\w+)/i', $a->text, $output);
print_r($output); produces:
Array
(
)
Array
(
)
Array
(
[0] => GA 5 Cars @mustang
[1] =>
[2] =>
[3] => 5
[4] => mustang
)
Array
(
)
Array
(
)
Array
(
[0] => Give 3 Cars @ford
[1] => 3
[2] => ford
)
Array
(
[0] => Give 5 Cars @cobra_gt
[1] => 5
[2] => cobra_gt
)
As you can see it is not working with the lowercase ones, and for number #3 it doesn't produce the right array, it produces empty elements. Any idea where I am going wrong here?
Thank you very much,
Ice