Hey,
I have opened a text file and placed the contents into an array. The following command produces the expected result:
Command
echo $strArticle[0];
Result
DATE: Tue 30-Sep-1997
AUTHOR: wright
FULL TEXT:
BART WRIGHT: You gotta like these guys' chances
There were times during the season when they played like a team
for the ages, a team that could match up with the greatest
postseason teams in baseball history...
I desire to pass the value of that array to a regex that breaks the value into 4 different pieces and inserts them into a new array. I'll be using the new array values in a MySQL insertion query. Here is my first attempt:
Command
ereg("DATE: (.*)<br>$", $strArticle[0], $strArticleField);
echo $strArticleDate = $strArticleField[1];
Result
Tue 30-Sep-1997
AUTHOR: wright
FULL TEXT:
BART WRIGHT: You gotta like these guys' chances
There were times during the season when they played like a team
for the ages, a team that could match up with the greatest
postseason teams in baseball history...
As you can see, I was successful in getting just the date (that is, DATE: and <br> have been removed) but the rest of the contents of the array element were included. My problem is that I don't want anything but the actual date.
I assume that I have made a mistake in my ereg statement or I don't understand how ereg works. Perhaps I should be using a different function? Any advice would be welcomed.
Thanks,
Jerry Cornelius
newsgroups@multiverse.org