Kbase P105550: MATCHES does not work as described in documentation
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  06/03/2006 |
|
Status: Unverified
SYMPTOM(s):
MATCHES does not work as described in documentation if the "." (period) is used.
The code:
MESSAGE "ab" MATCHES "~.b" .
VIEW-AS ALERT-BOX INFO BUTTONS OK.
displays TRUE where according to the doc it should display FALSE.
CAUSE:
When the above piece of code is compiled, the 4GL interprets the tilde as an escape character for the dot, which is a dot itself.
What gets then written into the rcode is the string ".b", which is fed to the MATCHES function and which results as TRUE.
Basically, it all works as if the tilde was not there, and it's expected that it is so.
FIX:
What should be coded instead is:
MESSAGE "ab" MATCHES "~~.b"
VIEW-AS ALERT-BOX INFO BUTTONS OK.
This way, the first tilde escapes the second one, and what is written into the rcode is the string "~.b".
This is fed to MATCHES, which sees the tilde and does escape the dot. As a result, MESSAGE will return NO.