CLEAR ALL
' b$ is the regular expression to search for, f$ is the file
b$=""
f$="AliceInWonderland.txt"
PRINT
PRINT "Enter a regular expression to search for in file ";CHR$(34);f$;CHR$(34)
PRINT
PRINT "(e.g. ";
INK RGB(255,255,0)
PRINT "^Alice";
INK RGB(255,255,255)
PRINT " searches for any line that starts with Alice)"
PRINT
INK RGB(255,255,0)
INPUT b$
INK RGB(255,255,255)
n=FREEFILE
OPEN f$ FOR INPUT AS #n
i=0
DO UNTIL EOF(n)
    i=i+1
    INPUT #n,a$
    c=REGEXPR(a$,b$)
    IF c THEN PRINT i;": ";a$
LOOP
CLOSE #n
