[thelist] PHP regex for catching text between "<?php" and "?>"

Jon Haworth jhaworth at witanjardine.co.uk
Mon Jun 11 10:30:42 CDT 2001


Hi list,

Here's my current mission: Using PHP, find all occurrences of a string that
don't fall between "<?php" and "?>". 

Example: Given the string "hello <?php there ?> world <?php foo ?>",
generate an array with element 0 as "hello" and element 1 as "world".

I'm fairly sure that I need to use preg_match (www.php.net/preg-match) to
return my array, the bit I'm having problems with is forming the regex
properly. Not being much good in this department doesn't help :-)

Any kindly regex gurus feel like demonstrating their wizardry and giving me
a pointer?

Cheers
Jon


**********************************************************************
'The information included in this Email is of a confidential nature and is 
intended only for the addressee. If you are not the intended addressee, 
any disclosure, copying or distribution by you is prohibited and may be 
unlawful. Disclosure to any party other than the addressee, whether 
inadvertent or otherwise is not intended to waive privilege or confidentiality'

**********************************************************************




More information about the thelist mailing list