Skip to content

Instantly share code, notes, and snippets.

@markingman
Last active August 29, 2015 14:01
Show Gist options
  • Save markingman/236d8b75bac861361772 to your computer and use it in GitHub Desktop.
Save markingman/236d8b75bac861361772 to your computer and use it in GitHub Desktop.
BBEdit Text Filter: reset PHP links
#!/usr/bin/php
<?php
/**
* BBEdit reset PHP links text filter
* When editing attributes for <a> tag with PHP link (<a href="<?=FOO?>">), reset '&lt;?=...?&gt;' to '<?=...?>'
*/
while($l = fgets(STDIN))
{
$l = preg_replace('~ (action|href)="&lt;\?=(\$*[^\?]+)\?&gt;"~',' \1="<?=\2?>"',$l);
echo $l;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment