<div dir="auto">I seem to recall doing something like this with a recursive call. It's obviously resource intense if you get a huge amount of traffic but works fine. I had a rough working recipe before other parts of life took me away. I can look for what I did if it might help.<div dir="auto">--Peter Kay </div></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Tue, Feb 10, 2026, 7:20 a.m. Hans Bracker <<a href="mailto:design@softflow.uk">design@softflow.uk</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Yes, sum does work. The MarkupExprPlus recipe definitions of add, sub, <br>
mul and div don't work with 'strcount'. I can fix it and get the value, <br>
not the token,  by adding a line of code to top of the function, like <br>
this, calling MarkupRestore():<br>
<br>
function MEP_nums($params) {<br>
   $params = trim(MarkupRestore($params));<br>
   $params = preg_split('/\\s+/', $params);<br>
   $args = array();<br>
   foreach ($params as $p) {<br>
     list($d) = sscanf($p, "%g");<br>
     if (is_numeric($d)) $args[] = $d;<br>
   }<br>
   return $args;<br>
}<br>
<br>
Is there another way than rewriting recipes?<br>
<br>
Hans<br>
<br>
<br>
On 10/02/2026 10:44, Petko Yotov wrote:<br>
> This seems to work for me.<br>
><br>
> I tried your code, and the {(sum)} expression on the Cookbook, with <br>
> this markup:<br>
><br>
>   {(sum (strcount are PmWiki.BasicEditing) -6)}<br>
><br>
> The string "are" appears 16 times in my BasicEditing.<br>
><br>
> The result is correctly 16 - 6 = 10.<br>
><br>
> Definition:<br>
> $MarkupExpr['sum'] = 'array_sum($args)';<br>
> $MarkupExpr['strcount'] as below.<br>
><br>
> Petko<br>
><br>
<br>
_______________________________________________<br>
pmwiki-users mailing list<br>
<a href="mailto:pmwiki-users@pmichaud.com" target="_blank" rel="noreferrer">pmwiki-users@pmichaud.com</a><br>
<a href="http://www.pmichaud.com/mailman/listinfo/pmwiki-users" rel="noreferrer noreferrer" target="_blank">http://www.pmichaud.com/mailman/listinfo/pmwiki-users</a><br>
</blockquote></div>