Re: [PHP] Help with ereg()

2003-03-12 Thread fLIPIS
No, actually i was wrong about this subject. The correct Regular Expression for this is the following: preg_match_all("/(<\?.*?\?>)/ims",$text,$source_code); The anterior was greedy, and so it matched the following: And now it only takes the text between , even multilined code. -- PHP Gene

Re: [PHP] Help with ereg()

2003-03-11 Thread fLIPIS
¡¡¡ Got it !! It even matches the linebreaks, so it can color multi-line code. Look at this sample: - TEXT TO USE FOR SEARCHING PATTERNS -- -- END TEXT --- Scri

RE: [PHP] Help with ereg()

2003-03-11 Thread Niklas Lampén
iskuuta 2003 14:59 To: [EMAIL PROTECTED] Subject: [PHP] Help with ereg() Hi all. I'm trying to deal with Regular Expressions, but somehow it is getting more difficult. I´m trying to do the folowing: Read a text and get all of the PHP code out of it, highlight it and then print all in nice HTML.

[PHP] Help with ereg()

2003-03-11 Thread Alejandro
Hi all. I'm trying to deal with Regular Expressions, but somehow it is getting more difficult. I´m trying to do the folowing: Read a text and get all of the PHP code out of it, highlight it and then print all in nice HTML. I'm using this to get the PHP code: ereg("<\?.*\?>",$Text,$PHP_code); It