Kbase 12195: How to use MATCHES on a literal asterisk USE "*~~**" TILDE
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  5/10/1998 |
|
How to use MATCHES on a literal asterisk USE "*~~**" TILDE
To use the MATCHES function to match the '*' literally,
insert a double tilde (for example, type "*~~**"). Also use a double
tilde in the WHERE clause definition of RESULTS.
The following code is an example which uses the double tilde.
DEF WORKFILE x FIELD y AS CHAR FIELD z AS INT.
CREATE x.
ASSIGN y = "*" z = 1.
CREATE x.
ASSIGN y = "a*" z = 2.
CREATE x.
ASSIGN y = "b*b" z = 3.
CREATE x.
ASSIGN y = "c*" z = 4.
CREATE x.
ASSIGN y = "d" z = 5.
FOR EACH x:
DISPLAY x.
END.
FOR EACH x WHERE y MATCHES "~~*":
DISPLAY x WITH COLUMN 40 TITLE "matches ~*".
END.
This procedure displays only the record where z = 1 in the second
FOR EACH loop.
Progress Software Technical Support Note # 12195