Programma di esempio REX.PRT |
; REX
;
; Programma per Proteus
;
; (C) 1998-2003 Simone Zanella Productions
;
; Vari test con le espressioni regolari.
; Non usa alcun ingresso; l'uscita è inviata a console.
; Si otterranno una serie di '1' e '0' alternati.
; Parametri impliciti: input e output predefiniti nulli
;!proteus -z
CONSOLELN REXMATCH("all stars", "^a")
CONSOLELN REXMATCH("begin", "^a")
CONSOLELN REXMATCH("camera", "a$")
CONSOLELN REXMATCH("video", "a$")
CONSOLELN REXMATCH("mida", "m..a")
CONSOLELN REXMATCH("manna", "m..a")
CONSOLELN REXMATCH("abacab", "^[abc]*$")
CONSOLELN REXMATCH("cdecd", "^[abc]*$")
CONSOLELN REXMATCH("cdecd", "^[^ab]*$")
CONSOLELN REXMATCH("abacab", "^[^ab]*$")
CONSOLELN REXMATCH("30/12/97", "^[0-3][0-9]/[0-1][0-9]/[0-9][0-9]$")
CONSOLELN REXMATCH("40/12/97", "^[0-3][0-9]/[0-1][0-9]/[0-9][0-9]$")
CONSOLELN REXMATCH("I will go then", "th(e|i)n")
CONSOLELN REXMATCH("in", "th(e|i)n")
CONSOLELN REXMATCH("it's thin", "th(e|i)n")
CONSOLELN REXMATCH("the", "th(e|i)n")
CONSOLELN REXMATCH("the unknown", "thee?")
CONSOLELN REXMATCH("th", "thee?")
CONSOLELN REXMATCH("I see thee", "thee?")
CONSOLELN REXMATCH("hee", "thee?")
CONSOLELN REXMATCH("123000", "^[0-9]*$")
CONSOLELN REXMATCH("1.25E23", "^[0-9]*$")
CONSOLELN REXMATCH("Field1", "^[a-zA-Z]+[a-zA-Z0-9]*$")
CONSOLELN REXMATCH("1FIELD", "^[a-zA-Z]+[a-zA-Z0-9]*$")
CONSOLELN REXMATCH("hello", "^(hello)|(goodbye)$")
CONSOLELN REXMATCH(" hello", "^(hello)|(goodbye)$")
CONSOLELN REXMATCH("goodbye", "^(hello)|(goodbye)$")
CONSOLELN REXMATCH("goodbye ", "^(hello)|(goodbye)$")
CONSOLELN IMATCH("the hose", "*h?se*")
CONSOLELN IMATCH("the house", "*h?se*")
CONSOLELN IMATCH("castle", "c*")
CONSOLELN IMATCH("the church", "c*")
CONSOLELN IMATCH("beauty", "*y")
CONSOLELN IMATCH("ready ", "*y")
CONSOLELN IMATCH("123", "???")
CONSOLELN IMATCH("1234", "???")
CONSOLELN IMATCH("I'll tell you one, two and three", "*one*two*three*")
CONSOLELN IMATCH("three two one", "*one*two*three*")