Posted By

sherakama on 11/03/10


php textmate keyword multiple highlighter

Versions (?)

Who likes this?

1 person have marked this snippet as a favorite


Keyword Highlighter

 / Published in: PHP

  1. function _hl($c,$q){
  2. $q=explode(' ',str_replace(array('','\','+','*','?','[','^',']','$','(',')','{','}','=','!','<','>','|',':','#','-','_'),'',$q));
  3. for($i=0;$i<sizeOf($q);$i++)
  4. $c=preg_replace("/($q[$i])(?![^<]*>)/i","<span class="highlighted">${1}</span>",$c);
  5. return $c;
  6. }

Report this snippet  

You need to login to post a comment.