Dave Navarro, Jr. (dave@powerbasic.com) EXTRACT LINKS FROM TEXT FILE ------------------------------------------------------------------------------ 'This is a quick & dirty little utility I wrote to extract all of the links 'in a text file and display them on the screen (redirectable). FUNCTION PbMain() LOCAL htmlfile AS STRING LOCAL buffer AS STRING LOCAL link AS STRING LOCAL s AS LONG LOCAL l AS LONG htmlfile = TRIM$(COMMAND$) IF ISFALSE LEN(DIR$(htmlfile)) THEN PRINT "Error: "; htmlfile;" not found." EXIT FUNCTION END IF OPEN htmlfile FOR BINARY AS #1 GET$ #1, LOF(1), buffer CLOSE #1 STDOUT "File: " & htmlfile STDOUT "" s = 1 DO REGEXPR ".+" IN buffer AT s TO s, l IF ISFALSE s THEN EXIT DO ELSE link = REMOVE$(MID$(buffer, s, l), ANY CHR$(13,10)) END IF STDOUT link s = s + l LOOP END FUNCTION