786snow
Programmer
- Nov 12, 2006
- 75
Hi,
I have a text file notes.txt, which has following content
**********
Site information
-ustaxrelief1
-Offer id 1773
-New Creative
-Doing Targus validation in the controller.
-Lead is not going to the lead agent, instead going straight to the buyer.
-lead saved in the the posted_lead table.
*******************
I want to get the number 1773 out of it. I have a script that does it for me
Now my problem is sometime it is in following format
and sometimes like
How can I change myscript so that it checks if it has two number and if it does, grab the second number as well?
I will appreciate your help.
Thanks
I have a text file notes.txt, which has following content
**********
Site information
-ustaxrelief1
-Offer id 1773
-New Creative
-Doing Targus validation in the controller.
-Lead is not going to the lead agent, instead going straight to the buyer.
-lead saved in the the posted_lead table.
*******************
I want to get the number 1773 out of it. I have a script that does it for me
Code:
$file = file("notes.txt");
foreach ( $file AS $line )
{
if ( preg_match("/-Offer id (\d+)/", $line, $foo) )
{
echo "The offer id is: " . $foo[1] . "\n";
}
}
Now my problem is sometime it is in following format
Code:
-Offer id 1773
and sometimes like
Code:
-Offer id 1773 and 1667
How can I change myscript so that it checks if it has two number and if it does, grab the second number as well?
I will appreciate your help.
Thanks