I need a javascript regex that can distinguish between PHP tags in HTML tags and PHP tags outside of HTML tags.
e.g.
<input type="text" <? print '1'; ?> value="<? print '2'; ?>">
<? print '3';?>
So I need a regex to pull out:
<? print '1'; ?> and <? print '2'; ?>
And another regex to pull out:
<? print '3';?>
At the moment I have this regex which pulls out all PHP tags regardless of where they are:
/\n?<\?(php)?(\s|[^\s])*?\?>\n?/ig