I need to find all short PHP tags.
The regex for it
The best way to find short-tags in vim is to find all occurrences of
<? not followed by a
The reason your regex is failing in vim is because
/? finds literal question marks, while
\? is a quantifier;
/<\? in vim will attempt to find 0 or 1 less-than signs. This is backwards from what you might expect in most regular expression engines.
If you want to match short tags that are immediately followed by a new line, you cannot use
[^p], which requires there to be something there to match which isn't a
p. In this case, you can match "not p or end-of-line" with