I’d like to replace all of the php short tags to full blown ones.
Example source text:
<a href="<?=$baseurl?>random/<?php echo $offset+$per_page; ?>" class="arrows right" <?php echo $displayright; ?>></a>
Expected final result:
<a href="<?php echo $baseurl; ?>random/<?php echo $offset+$per_page; ?>" class="arrows right" <?php echo $displayright; ?>></a>
I got as far as this:
Find what: <?=(.*)?>
Replace with: <?php echo \1; ?>
But the result is:
<a href="<?php echo $baseurl?>random/<?php echo $offset+$per_page; ?>" class="arrows right" <?php echo $displayright; ; ?>></a>
So it doesn’t really work when there are multiple php opening and closing tags on one line.
How do I fix this? Thanks!
Yes, because the
*operator is greedy and will try to match everything up to the final?. You can fix this by matching everything except the?in the closing tag:Find what:
<?=([^?]*)?>Replace with:
<?php echo \1; ?>