RosettaCodeData/Task/Regular-expressions/ALGOL-68/regular-expressions-1.alg
Ingy döt Net b83f433714 tasks a-s
2013-04-10 23:57:08 -07:00

13 lines
344 B
Text

INT match=0, no match=1, out of memory error=2, other error=3;
STRING str := "i am a string";
# Match: #
STRING m := "string$";
INT start, end;
IF grep in string(m, str, start, end) = match THEN printf(($"Ends with """g""""l$, str[start:end])) FI;
# Replace: #
IF sub in string(" a ", " another ",str) = match THEN printf(($gl$, str)) FI;