On 10/04/06, Andy <[EMAIL PROTECTED]> wrote:
> >> text1 /ptext2 /otext3
> > Does it always look like that?
> > text1(whitespace)/ptext2(whitespace)/otext3
>
> The ideea is to extract the texts before and between /o and /p.
> $html = "asdäüü ö ö vf /pxtestxx/ostestss";
> eregi("^([^/.*]*)", $html, $reg); print_r($reg); //text is in reg[1]
> eregi("^(.*)/p([^/.*]*)", $html, $reg); print_r($reg); //text is in reg[2]
> eregi("^(.*)/o([^/.*]*)", $html, $reg); print_r($reg); //text is in reg[2]
>
> This example works, but I thought there might be a better way to extract the
> texts, with a single ereg or preg_match.

Well... slightly.

preg_match( '#^(+)/p(.+)/o(.+)$#',
preg_replace('#^(.+)(/o.+)(/p.+)$#', '$1$3$2', $html), $reg);

  -robin

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to