Not sure if im just being stupid or something but here goes i work for Shape5.com and i made there Vertex Framework the problem is Joomla keeps updating and this has popped up in our forums several times the error is Warning: preg_replace() [function.preg-replace]: Compilation failed: unmatched parentheses at offset 67
this is our code
<?php
$script = "Hello window.addEvent('domready', function(){ new Fx.Accordion($$('div#template-sliders-116.pane-sliders > .panel > h3.pane-toggler'), $$('div#template-sliders-116.pane-sliders > .panel > div.pane-slider'), {onActive: function(toggler, i) {toggler.addClass('pane-toggler-down');toggler.removeClass('pane-toggler');i.addClass('pane-down');i.removeClass('pane-hide');Cookie.write('jpanesliders_template-sliders-116',$$('div#template-sliders-116.pane-sliders > .panel > h3').indexOf(toggler));},onBackground: function(toggler, i) {toggler.addClass('pane-toggler');toggler.removeClass('pane-toggler-down');i.addClass('pane-hide');i.removeClass('pane-down');if($$('div#template-sliders-116.pane-sliders > .panel > h3').length==$$('div#template-sliders-116.pane-sliders > .panel > h3.pane-toggler').length) Cookie.write('jpanesliders_template-sliders-116',-1);},duration: 300,opacity: false,alwaysHide: true}); });";
$script = preg_replace("/window.addEvent('domready', function(){ new Fx.Accordion(.*?)}); });/", '', $script);
echo $script;
?>
the problem is the Fx.Accordion is forever changing depending on what template they use and this is really bugging me now sometimes it works sometimes it doesn’t ive tried escaping some all and none but still get the error the code above will reproduce the error exactly as we see it if anyone could help that be smashing.
Offset 67 is the last ) and yes ive tried escaping it removing it u name it ive tried 😀
I bet its something simple lol
Thanks Dave
Parentheses are special characters in PCRE for capture grouping, which require escaping via backslash, as do the
{}which would otherwise be range specifiers, and the dot..I think I have that all properly escaped. I assume the
(.*?)was not intended to be a capture group. The?is actually unnecessary in there because.*implies zero or more of any character.Update: If the
(.*?)was intended as a nongreedy match group, then don’t escape it.