tags:

views:

43

answers:

3

here is my code :

<html>
titi
<?

print "toto"+"<br>"

?>
<html>

and i want only the lines between the <? and ?> the only regexp thaht i've found was :

<?.*\n*?\?>

but it lacks the first <?

so if anyone have any idea it drives me nuts ... Regards and thanks for all people. Bussiere

+1  A: 

You should escape the first ?:

<\?.*\n*?\?>

This regex would be more robust I think:

<\?.*?\?>

(specify the multiline option, so . will match newlines also)

Philippe Leybaert
A: 

Escape the first ?

<\?.*\n*?\?>
methodin
+1  A: 

You need to add a backslash before the first question mark (also you should use the regex's multiline mode):

<\?.*?\?>
Platinum Azure