Yii 1.1: regularexpressionhighlighter

will render regular expressions on your page with javascript for a nicer display
1 follower

Short Description

Will add a Javascript based RegularExpression Syntaxhighlighter to Yii.


  • The colorization output is from: Steven Levithan
  • The dynamic hovering of brackets and so on is from: Jeff Roberson
  • The extension and functionWrapping is from me


No requirements - the javascript is bundled..

Yii-1.1 and firefox is tested.. so it might happen, that some parts don't work with ie..



This extension mostly doesn't need configuration - but if you want:

$cssFile; // will overwrite the colorcss-file from syntaxhighlighter - look at the original cssfile what you can change
$className = 'regex'; // css-classname which should be highlighted
public $dynamic = true; // if the dynamichighlighter should be included or only coloroutput
public $functionName; // if you don't want autoloading that script and toggle it by a function


Most important is that your regex lies within a container of class="regex" - then you just have to add the extension and it will work But this example will show you the functionName configuration

<input type="button" onclick="javascrip:regexHighlight()" value="Highlight or remove Highlight of that regex" />
<div class="regex" style="width:700px;">
<?php $this->widget('application.extensions.EReSyntaxHighlighter.EReSyntaxHighlighter', array('functionName'=>'regexHighlight'));?>


Be the first person to leave a comment

Please to leave your comment.

Create extension