
Ah - thanks for the clarification... I could continue to live with the old behaviour - twould just be nice if it were mentioned in the style manual because it is not that intuitive. If it is changed, that's fine with me too. I just tried - I can also do: name ~ '.*\(.*\).*' { set name='${name|subst:"(=>"}'; set name='${name|subst:")=>"}'; echo "namehasbracket=1" } so that's the easiest (I was looking for closing parentheses only anyhow). Thanks a lot... On 28.07.2014 12:19, Steve Ratcliffe wrote:
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.
..Steve
-- keep on biking and discovering new trails Felix openmtbmap.org & www.velomap.org