Reputation: 11939
Hi i'm trying to find all occurences of '<?' in my php code. I use eclipse for this, and i tried to search for the folowing pattern: "<\?^[p]" in the hope this would return me all <? occrences, but not the <?php ones..
What's wrong about the regex? I thought I had figured out regular expressions, but it seams like i still have a long way to go :(
Upvotes: 1
Views: 327
Reputation: 16024
From what I understand you want to change <?
to <?php
. Try replacing <\?(?!php)
with <?php
. (This will prevent <?php
from turning into <?phpphp
).
Upvotes: 0
Reputation: 5525
If all fails, you could use a trick with no regexes: replace your <?php
occurrences with something else (like for example THE_PHP_TAG
), then search for <?
, then replace THE_PHP_TAG
back to <?php
.
Upvotes: 2
Reputation: 838806
I'm not familiar with Eclipse's regular expression language but I'd imagine you want this:
"<\?[^p]"
The difference is:
[^p]
means any character apart from p
^[p]
means the start of a new line followed by a p
.But you should check the manual for Eclipse to find out the exact regular expression syntax that Eclipse uses.
Upvotes: 2