Mapnik 4.0.3 Release Oct 30, 2024 | Artem Pavlenko
Mapnik 4.0.2 Release Aug 21, 2024 | Artem Pavlenko
Mapnik 4.0.1 Release Jul 30, 2024 | Artem Pavlenko
Mapnik 4.0.0 Release Jun 16, 2024 | Artem Pavlenko
Mapnik 3.1.0 Release Jan 08, 2021 | Artem Pavlenko
Mapnik 3.0.24 Release Jan 05, 2021 | Artem Pavlenko
Mapnik 3.0.23 Release Jan 18, 2020 | Artem Pavlenko
Mapnik 3.0.22 Release Jan 22, 2019 | Artem Pavlenko
Mapnik 3.0.21 Release Oct 08, 2018 | Artem Pavlenko
Mapnik 3.0.20 Release Apr 12, 2018 | Artem Pavlenko
Mapnik 3.0.19 Release Mar 06, 2018 | Artem Pavlenko
Mapnik 3.0.18 Release Jan 26, 2018 | Artem Pavlenko

latest news

Regex replace

Dec 16, 2009

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:

<mapnik-expression>.replace(<regex>,<pattern>)

Here is a small example :

from mapnik import *
f = Feature(1)
f["name"] = 'Mapnik'
expr = Expression("[name].replace('(\\B)|( )','$1 ')")
expr.evaluate(f)

The above should result in:

'M a p n i k'
Copyright © 2024 Artem Pavlenko | Downloads | License | Media | Developer