I need to find all short PHP tags.
The regex for it <\?(?!php) but I can not use it in vim.
How to “convert” it to vim?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The best way to find short-tags in vim is to find all occurrences of
<?not followed by ap: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 ap. In this case, you can match “not p or end-of-line” with