<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html><body style='font-size: 10pt; font-family: Verdana,Geneva,sans-serif'>
<p>Hi,</p>
<p>I am trying to normalise street names by removing any dots. So far I have been unable to get the subst function to do what I want. The problem seems to be getting the dot to be taken literally in the subst parameters.</p>
<p>I have tried:</p>
<p>a) set newname='${name|subst:. +=> }'</p>
<p>b) set newname='${name|subst:\. +=> }'</p>
<p>c) set newname='${name|subst:[.] +=> }'</p>
<p>All of the above seem to have no effect, i.e. newname ends up the same as name.</p>
<p>I am thinking of doing it in two stages: firstly replacing ". " (dot followed by space) with a space, and then replacing any other dots with a space so "A.B. Street" ends up as "A B Street". I could also do it by replacing any dots by spaces and then compressing multiple spaces. But in both cases I need subst to match a literal dot.</p>
<p>My current style rules look like this:</p>
<p>highway=* & name ~ '.*[.].*' {set newname='${name|subst:\. +=> }'}<br />newname=* {echo "dots changed from ${name} to ${newname} (1)"; set name='${newname}'}<br />highway=* & name ~ '.*[.].*' {set newname='${name|subst:[.]=> }'}<br />newname=* {echo "dots changed from ${name} to ${newname} (2)"; set name='${newname}'}</p>
<p>Can anyone help please?</p>
<p>Colin</p>
<p> </p>
<div> </div>
</body></html>