[pmwiki-users] Blocklisting 'href', but allowing '\href'?

christian.ridderstrom at gmail.com christian.ridderstrom at gmail.com
Wed Apr 16 01:51:22 CDT 2008

On Sun, 13 Apr 2008, Patrick R. Michaud wrote:

> On Sun, Apr 13, 2008 at 06:43:08PM +0200, christian.ridderstrom at gmail.com wrote:
>> Hi,
>> To prevent spam, I wanted to block 'href' and I did it by adding the
>> following entry to Site.Blocklist
>> 	block:/\bhref\b/
>> This will block 'href' as long as it is not a part of a word, e.g. in
>> 	<a href=...
>> which spambots often insert... However, authors of the site (www.lyx.org)
>> may sometimes actually want to write '\href', as it's a command in LaTeX.
>> So my question is how I can allow '\href', but block 'href'?
>    block:/[^\w\\]href\b/
> This blocks any instance of 'href' that is preceded by anything other 
> than a word character or a backslash.

Hi Patrick,

It's been a while seen we talked last, thank you very much for the 
solution. The documentation is on the page


to which I added the following text:

!!!! Regular expression to block 'href'

If you want to block '@@href@@', you can use the following markup:
-> [@block:/[^\w\\]href\b/@]
which blocks '@@href@@', but neither '@@\href@@' nor '@@toughref@@'.

The regular expression can be interpreted as follows: Match any character 
that is '''neither''' a word character
'''nor''' a '\', followed by @@href@@ which ends in a word boundary.


Christian Ridderström, +46-8-768 39 44               http://www.md.kth.se/~chr

More information about the pmwiki-users mailing list