[pmwiki-users] Regex help (excluding spaces)
surname at larseighner.com
Sun Mar 10 00:19:23 CST 2013
On Sat, 9 Mar 2013, Eric Forgeot wrote:
> Markup ('txt2tags_bold' , 'directives', '/\*\*[^\s](.*?)[^\s]\*\*/'
> , "'''$1'''");
> 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
Because the $1 stands for the first parenthesized part of the pattern. The
first letter is swallowed by [^\s] which is NOT in the parentheses.
Likewise the last letter which matches the [^\s] after the parentheses.
'/\*\*([^\s].*?[^\s])\*\*/' should fix the missing first and last letters,
but I am not vouching for the markup being bulletproof.
You know, there is ready-made markup for bold in single * and italic in
single / (these were conventions that some mail and newreaders once
understood) already in the sample config file. You just have to uncomment
the lines in your real config.php (if you copied it from the sample).
8800 N IH35 APT 1191 AUSTIN TX 78753-5266
More information about the pmwiki-users