I try to find all occurences of <? on my site to replace them with <?php but occurences of <?php should be ignored.
Otherwise it would change <?php as well and would replace <?php with <?phpphp
Attempt: <\?\b(?!php)\b
I try to find all occurences of <? on my site to replace them with <?php but occurences of <?php should be ignored.
Otherwise it would change <?php as well and would replace <?php with <?phpphp
Attempt: <\?\b(?!php)\b
You don't need the word boundaries. You can use the RegEx <\?(?!php)
<\? matches <?
(?!php) makes sure your match isn't followed by php
| e.g. <\?(?!php|=). This ignores <?php and <?=.