Opened 11 years ago
Last modified 11 years ago
#10323 closed defect
Eval functions: regexp_test() and regexp_match() matching part of the string — at Version 2
Reported by: | plepe | Owned by: | team |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Core mappaint | Version: | |
Keywords: | Cc: |
Description (last modified by )
I noticed that the eval functions regexp_test() and regexp_match() needs a pattern which matches the whole input, and in case you just want to match a part of the input you have to add ".*" in the beginning and the end. This is not as I expected it (and I guess most other people would expect it). In fact it took me some time testing patterns and a final email to one of the developers to solve it.
Anyway. I think this doesn't even really make sense, especially for the regexp_match() function, which returns the matched substring as 0th element of the array (which will always be the whole string).
Also, it contradicts the regexp condition selector: node[shop=~/market/]
matches "supermarket" as well as "marketplace".
I would suggest to change regexp_test() and regexp_match() to match substring of the input string. You can always add ^
and $
to match the whole string. If this is not possible, maybe it would be possible to add a flag and improve documentation?
Change History (2)
comment:1 by , 11 years ago
Description: | modified (diff) |
---|
comment:2 by , 11 years ago
Description: | modified (diff) |
---|