[pmwiki-users] Alphabetize by Title Without Leading Articles or Special Characters

Jake Wartenberg jake at jakewartenberg.com
Sun Mar 20 15:21:56 CDT 2016

Hello all,

I suspect this is a pretty basic regex question.  I have quotation marks at
the beginning of some of my titles, so I modified the TitleNoArticle
function from the CustomPagelistSortOrderFunctions Cookbook page:

'preg_replace("/^ *((?:The|An?) |\")/i", "", (@$page["title"] ?
$page["title"] : $AsSpacedFunction($name)), 1)';

This works great for discarding the leading quotation marks, but I run into
a problem when I have *both* a leading quotation mark and an article
(the/a/an) at the beginning of my title, in which case the page gets
alphabetized under the article.  I would be really grateful to anyone who
could show me how to modify the function to account for this.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.pmichaud.com/pipermail/pmwiki-users/attachments/20160320/13bdabe5/attachment.html>

More information about the pmwiki-users mailing list