String /pattern formatting extraction question
| From: | Andy | Date: | Mon, 10 Apr 2006 12:40:54 +0000 |
| Subject: | String /pattern formatting extraction question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-233662@lists.php.net to get a copy of this message | ||
Hi to all,
I have the following pattern for a string:
text1 /ptext2 /otext3
Now, I want to extract the text by "patterns" from this string by the following rule:
no pattern -> text1 (what is before /o or /p)
/p -> text2 (what is after /p)
/o -> text3 (what is after /o)
The order betweeen /o and /p can be switched, so there is no rule that /p is before /o.
How can I do this? I tried ereg but no success.
Andy.