Re: Anyone have a tool/script to convert <? to <?php (but not <?=)
| From: | Joshua Kehn | Date: | Wed, 12 Feb 2014 23:10:26 +0000 |
| Subject: | Re: Anyone have a tool/script to convert <? to <?php (but not <?=) | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-322839@lists.php.net to get a copy of this message | ||
For bonus points:
(<\?\s+)\bCapture group also looking for a word boundary. http://l.kehn.io/image/1N202N3s082t
<\?=.+(;\s+)\?>Matches: http://l.kehn.io/image/242l003n3q1O Short tags? Really? Why do I bother. --jk On 12 Feb 2014, at 14:56, Daevid Vincent wrote:
Thanks guys for the replies so far, however, if it were a simple search and replace I wouldn't have to ask ;-) The trick is that "<?=" is valid and legal and I want to keep those. I only want to change if they are specifically "<?" Maybe there is some regex guru out there that knows the magic incantation. Related, for extra credit it drives me bonkers to see this: Hello <?= $username; ?> Note the end semicolon on the variable. I'd want to strip all those off too, but that is also not a trivial task if you think about it as it can only be removed if proceeded with <?= -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php