> 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?

This seems to work.

preg_match_all("/<!-- [0-9]+ -->([a-z ]+)/i",$text,$matches);

$matches will be an array with the values your after in it. Do a
print_r() on it to see how it's structured. 

Or, if you're text is always like that, you could just match what's
between the > and < characters, too.

---John W. Holmes...

PHP Architect - A monthly magazine for PHP Professionals. Get your copy
today. http://www.phparch.com/



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

Reply via email to