Consultor Eletrônico



Kbase P112787: How to Use MATCHES to match the character literal '*' in a string?
Autor   Progress Software Corporation - Progress
Acesso   Público
Publicação   23/01/2006
Status: Unverified

GOAL:

How to Use MATCHES to match the character literal '*' in a string?

FIX:

Use ~~ before the '*' character literal.
/* matches.p */
/* In the following you will see x displayed but not y since x contains the '*' character literal and y does not. */
DEF VAR x AS CHAR FORMAT "x(20)".
DEF VAR y AS CHAR FORMAT "x(20)".
ASSIGN
x = "vvvvvvv*hhhh**mmm"
y = "mmmmmjjjjjkkkkkkkk".
IF x MATCHES("*~~**") THEN DISPLAY x.
IF y MATCHES("*~~**") THEN DISPLAY y.