JOSM: Edit>Search>Replace Selection

I wish to edit the alt_name key of a group of nodes w/ similar alt_name values, such as B1, B2, B3, … etc. I want to change the first two characters "B" to three characters - "BO", so that my series of names will then have the form: BO1, BO2, BO3, … etc.

The Edit>Search> Replace Selection would seem to suggest it offers this ability if it works similar to search and replace in Excel and other programs, but I haven’t been able to figure out how to do this.

Is it possible to do what I’m seeking? Either w/ Edit>Search> Replace Selection … or some other method?

Thanks for your help!


You can use a regular expression in your search to find all the objects of interest.

To insert one character you would need to use the scripting plugin of JOSM. I can write some Python code that can do that for you.

The other way to go, is to use an XML editor and work on the OSM file directly. In that case it’s not enough to change the alt_name key. You also have to add action=‘modify’ for the objects you touch:

<node id='-20031' action='modify' visible='true' lat='50.5023543692732' lon='5.004308791675721'>
    <tag k='highway' v='give_way' />

If you do that on a lot of objects, it may be seen as a mechanical edit. So you have to make sure to discuss this change with the local community.


Thank you. That’s what I needed to know.