If I got this right :

preg_match_all ("#\!.*?>(.*?)<#si",$string,$match);

You will have an array ($match[1]) with all your subs in there.

-- georgep

----- Original Message -----
From: "Juan Pablo Aqueveque" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, January 20, 2003 9:11 PM
Subject: [PHP] a regular expression problem - split text


> Hi all
> I am sorry for the very simple question but I can't doing this.
>
> I have a text like this:
>
> $text=" <!-- 1 --> this is January <!-- 2 --> this is February <!-- 3 -->
> this is March <!-- 4 --> this is April ";
>
> OK.. i want to show e.g. "this is January" in my var $sub_text.
>
> How can i doing this using a regular expressions?
>
> <?php
>
> ereg("(help-me-with-a-regulars-expressions-sentence)",text,$sub_text);
> echo $sub_text[0];
>
> ?>
>
> thanks a lot
>
> ________________________________________________________
> Juan Pablo Aqueveque <[EMAIL PROTECTED]>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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

Reply via email to