Frank Arensmeier wrote:
>>> See:
>>> http://www.cegepsherbrooke.qc.ca/~languesmodernes/test/test.php
>>> http://www.cegepsherbrooke.qc.ca/~languesmodernes/test/test.phps
>>>
>>> In $mystring, I need to extract everything between "|News
Releases|" and
>>> "-30".
>>>
>>> My approach would be to split the hole text into smaller chunks
(with e.g. explode()) and extract the interesting parts with a regular
expression. Maybe this will give you some ideas:
>>>
>>> $chunks = explode("-30-", $mystring);
>>> foreach($chunks as $chunk) {
>>> preg_match_all("/News Releases\n(.+)/s", $chunk, $matches);
>>> var_dump($matches[1]);
>>> }
>>>
>>> The regex matches all text between "News Releases" and the end of
the chunk.
>>>
>>> /frank
>>>
>>>
I could live with that, I think. Here is the output:
http://www.cegepsherbrooke.qc.ca/~languesmodernes/test/test2.php
Here are the newbie questions
Why is there more than one array?
array(1)
What are string(190) and string string(247)? Why are they named like that?
http://www.cegepsherbrooke.qc.ca/~languesmodernes/test/test2.php
Please explain the / (.+)/s in "/News Releases\n(.+)/s"?
My question is:
Is one array not better? (My next step will be to parse the array to
find the frequency of each word ... an array.)
array {
[0]=> "Residential Fire Determined to be Accidental in Nature
(SUMMER BROOK, ON) – May 31, 2012 – The Police Department has determined
the cause of a residential fire to be accidental in nature.
"
[1]=>
"Residential Fire Determined to be Accidental in Nature
(SUMMER BROOK, ON) – June 3rd, 2012 – The Police Department has arrested
two suspects in the case of a residential fire on May 31st. It is now
believe the fire was not accidental in nature.
"
}
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php