What it means for a regex to "MATCH" is undocumented and implications are misleading
It's not clear from the regex specification whether a regex matching a substring implies it MATCH
es the whole string. For example, phrasing like:
The quoted argument
"\\(\\a\\+b\\)"
specifies a regex that matches the exact string(a+b)
Seem to imply the answer is no (because you said “exact string”), but this prints "YES":
if("xyz(a+b)" MATCHES "\\(\\a\\+b\\)")
message("YES")
endif()
If you'd said “the exact substring” above you wouldn't be making that implication. This is just one of many examples. I think if you're making a distinction between the english word “match” and the keyword MATCH
, that is too subtle for readers (and probably maintainers of the text).
There should be a clear statement up-front about what it means to match. That may be a little subtle to write because you need another term than “match” to describe the satisfaction of the regexp on a substring.