Help Regex Language Processing, simple small task
- From: "Falazar" <falazar@xxxxxxxxx>
- Date: 15 Feb 2006 09:01:23 -0800
I am able to do some great big things with regex and have done some
really complicated extraction procedures, but what I really need now is
a small function that can take a large text string (from emails)
and match a word, and the text around it.
To whit - I can do this, the problem is, when the words occur more than
once, and are near eachother, it messes up the functioning.
Example: keyword is meeting
"This meeting will be @ 1000 in CR#1, Tuesday 10 January 2006. This
meeting should last no longer than one hour. "
I need to match the 45 chars before and after the word, say, so I do
this:
preg_match_all("/.{0,45}\W($match)\W.{0,45}/is", $string, $match2); //
s for multiline match
This returns only a little bit of what I need though:
[10] => le. This meeting will be @ 1000 in CR#1, Tuesday 10 Januar
[11] => y 2006. This meeting should last no longer than one hour. Than
So the first meeting takes over the second meetings text string,
I need something more like
[10] => le. This meeting will be @ 1000 in CR#1, Tuesday 10 Januar
[11] => CR#1, Tuesday 10 January 2006. This meeting should last no
longer than one hour. Than
Thanks,
James Ratcliff
Falazar@xxxxxxxxx
.
- Prev by Date: [Newbie] Little PHP script with Archive_Tar
- Next by Date: Re: Apache directory aliased scripts and safe_mode
- Previous by thread: [Newbie] Little PHP script with Archive_Tar
- Next by thread: safe_mode bug or what?
- Index(es):
Relevant Pages
|