logo separator

[mkgmap-dev] How can I test if "(" or ")" is part of name

From Steve Ratcliffe steve at parabola.me.uk on Mon Jul 28 11:19:26 BST 2014

On 28/07/14 10:15, Felix Hartmann wrote:
> name ~ '.*\(' { set name='${name|subst:"(=>"}'; echo "namehasbracket=1" }
> name ~ '.*\)' { set name='${name|subst:")=>"}'; echo "namehasbracket=2" }

I looked at the code and the way the code currently is, the pattern
has to match the whole name. Eg you would need '.*\(.*' and '.*\).*'
but the second one would happen to match if the closing bracket was
at the end of the string which it probably is in many cases.

I found this surprising so I suggest that we change this so
that it will match anywhere in the string.  That means that you
would just need '\(' to match an open parenthesis.

But this would not be entirely backward compatible, so it is up to
you guys as to whether it is worth doing or not.


More information about the mkgmap-dev mailing list