RegExLib.com - The first Regular Expression Library on the Web!

Please support RegExLib Sponsors

Sponsors

Regular Expression Details

Title Test Find Get all code inside of php tag in page
Expression
(\<\?php\s+.*?((\?\>)|$))
Description
Get code in between php tag <?php and ?> or until end of string if end of tag not found. Singleline option must be enabled!
Matches
<?php this is code in php ?>
Non-Matches
text outside php tag
Author Rating: The rating for this expression. David Havl
Source
Your Rating
Bad Good

Enter New Comment

Title

Name

Comment

Spammers suck - we apologize. Please enter the text shown below to enable your comment (not case sensitive - try as many times as you need to if the first ones are too hard):

Existing User Comments

Title: Almost
Name: Vlad Shamgin
Date: 8/12/2011 7:02:20 PM
Comment:
The above expression makes no-match for <?phpinfo();?> So I would say instead: (\<\?php.*?((\?\>)|$))


Copyright © 2001-2024, RegexAdvice.com | ASP.NET Tutorials