Regular expressions are very useful when working with text.
We already had ‘match’ operator which can be used in filter expressions. In Mapnik2 we now also have:
Here is a small example :
from mapnik import *
f = Feature(1)
f["name"] = 'Mapnik'
expr = Expression("[name].replace('(\\B)|( )','$1 ')")
The above should result in:
'M a p n i k'