Re: [josm-dev] MapCSS: Substitute characters in a text

2013-04-06 Thread Jo
Recently support for regular expressions was added to the JOSM
implementation of MapCSS.

http://josm.openstreetmap.de/wiki/Help/Styles/MapCSSImplementation#Evalexpressions

Maybe you can accomplish what you need with

regexp_match(regexp, string, flags)

It will return a list of matching groups, but I'm not sure how you can get
back from a list to a string.

It would be more convenient if the good soul who added the regex support
would also add a regex replace function.

Polyglot


2013/4/6 Martin Vonwald imagic@gmail.com

 Hi!

 Within a MapCSS style I have to replace some characters in an arbitrary
 text by others. Example: Roma - Napoli should be changed to Roma
 -#x3E; Napoli.

 The text comes from a tag so I don't have any knowledge of its content in
 advance, but I have to get rid of some characters. Any ideas how to do
 that?

 best regards,
 Martin
 ___
 josm-dev mailing list
 josm-dev@openstreetmap.org
 http://lists.openstreetmap.org/listinfo/josm-dev

___
josm-dev mailing list
josm-dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/josm-dev


Re: [josm-dev] MapCSS: Substitute characters in a text

2013-04-06 Thread Martin Vonwald
Hi!

I already tried that before asking on this list. But maybe I didn't use it
correct, so I hoped that someone here could give me a hint.

Martin


2013/4/6 Jo winfi...@gmail.com

 Recently support for regular expressions was added to the JOSM
 implementation of MapCSS.


 http://josm.openstreetmap.de/wiki/Help/Styles/MapCSSImplementation#Evalexpressions

 Maybe you can accomplish what you need with

 regexp_match(regexp, string, flags)

 It will return a list of matching groups, but I'm not sure how you can get
 back from a list to a string.

 It would be more convenient if the good soul who added the regex support
 would also add a regex replace function.

 Polyglot


 2013/4/6 Martin Vonwald imagic@gmail.com

 Hi!

 Within a MapCSS style I have to replace some characters in an arbitrary
 text by others. Example: Roma - Napoli should be changed to Roma
 -#x3E; Napoli.

 The text comes from a tag so I don't have any knowledge of its content in
 advance, but I have to get rid of some characters. Any ideas how to do
 that?

 best regards,
 Martin
 ___
 josm-dev mailing list
 josm-dev@openstreetmap.org
 http://lists.openstreetmap.org/listinfo/josm-dev



___
josm-dev mailing list
josm-dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/josm-dev


Re: [josm-dev] MapCSS: Substitute characters in a text

2013-04-06 Thread Paul Hartmann

Hi,

this should work:

*[name=~/-/]{
_match: regexp_match((.*?)-(.*), tag(name));
text: concat(get(prop(_match), 1), -#x3E;, get(prop(_match), 2));
}

Paul


On 04/06/2013 12:21 PM, Martin Vonwald wrote:

Hi!

I already tried that before asking on this list. But maybe I didn't use it
correct, so I hoped that someone here could give me a hint.

Martin


2013/4/6 Jo winfi...@gmail.com


Recently support for regular expressions was added to the JOSM
implementation of MapCSS.


http://josm.openstreetmap.de/wiki/Help/Styles/MapCSSImplementation#Evalexpressions

Maybe you can accomplish what you need with

regexp_match(regexp, string, flags)

It will return a list of matching groups, but I'm not sure how you can get
back from a list to a string.

It would be more convenient if the good soul who added the regex support
would also add a regex replace function.

Polyglot


2013/4/6 Martin Vonwald imagic@gmail.com


Hi!

Within a MapCSS style I have to replace some characters in an arbitrary
text by others. Example: Roma - Napoli should be changed to Roma
-#x3E; Napoli.

The text comes from a tag so I don't have any knowledge of its content in
advance, but I have to get rid of some characters. Any ideas how to do
that?

best regards,
Martin
___
josm-dev mailing list
josm-dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/josm-dev





___
josm-dev mailing list
josm-dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/josm-dev




___
josm-dev mailing list
josm-dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/josm-dev


Re: [josm-dev] MapCSS: Substitute characters in a text

2013-04-06 Thread Martin Vonwald
Hi!

Thanks, but you missed that part:

 The text comes from a tag so I don't have any knowledge of its content in
 advance, but I have to get rid of some characters.


The Roma - Napoli was just an example. I don't know how many characters
I have to replace. I just need to get rid of all , , [ and ] (at
least, maybe more), otherwise JOSM gets really angry with me ;-)

Thanks!
Martin
___
josm-dev mailing list
josm-dev@openstreetmap.org
http://lists.openstreetmap.org/listinfo/josm-dev