<font><font face="courier new,monospace">LOL @ petko :)<br clear="all"></font></font><div><font style="font-family:verdana,sans-serif" face="'courier new', monospace"><div style="text-align:left"><font size="1"><b><br>
<br></b></font></div></font><div><div><div style="font-family:verdana,sans-serif"><font size="1"><br></font></div></div></div></div>
<br><br><div class="gmail_quote">On 9 March 2013 21:40, Petko Yotov <span dir="ltr"><<a href="mailto:5ko@5ko.fr" target="_blank">5ko@5ko.fr</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">Eric Forgeot writes:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  Markup ('txt2tags_bold', 'directives', '/\*\*(.*?)\*\*/', "'''$1'''");<br>
<br>
It works but I get wrong output when having for example **this and **this, because this kind of text is not supposed to be marked as bold.  (**this and** should be bold on the other hand)<br>
<br>
So I modified my rule this way, to exclude white spaces before or after:<br>
<br>
    Markup ('txt2tags_bold'     , 'directives', '/\*\*[^\s](.*?)[^\s]\*\*/'       , "'''$1'''");<br>
<br>
Now it almost works, **this and **this are not catched, but the bold parts are not correct, the first and last letters are striped out, for example **another** would become nothe (in bold). Do you know why, and how to correct this?<br>

</blockquote>
<br></div>
You need to place the parentheses around everything that is meant to be bold, for example '/\*\*([^\s].*?[^\s])\*\*/' .<br>
<br>
However, this will not allow you a single bold character. This one will:<br>
<br>
  '/\\*\\*(\\S(.*?\\S)?)\\*\\*/'<br>
<br>
This means :<br>
 - starts with a '**'<br>
 - opening the first matched pattern (<br>
 - then a non-whitespace-character \\S, same as [^\\s]<br>
 - opening a second pattern (<br>
   - .* anything, ending with a non-whitespace-character \\S<br>
   - closing the second pattern )<br>
   - the ? after the ) means the pattern is optional<br>
 - closing the first matching pattern )<br>
 - once again '**'.<br>
<br>
This is fun :-)<span class="HOEnZb"><font color="#888888"><br>
<br>
Petko</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
<br>
______________________________<u></u>_________________<br>
pmwiki-users mailing list<br>
<a href="mailto:pmwiki-users@pmichaud.com" target="_blank">pmwiki-users@pmichaud.com</a><br>
<a href="http://www.pmichaud.com/mailman/listinfo/pmwiki-users" target="_blank">http://www.pmichaud.com/<u></u>mailman/listinfo/pmwiki-users</a><br>
</div></div></blockquote></div><br>