import { split } from "lib/Array.cms"; startTags = split("http:// https://", " "); endTags = split(".jpg .png .gif", " "); function findFirst(str, tags) { result = {pos: 0, tag: ""}; for (i = 0; i < tags.length; i++) { p = pos(str, tags[i]); if (p > 0 && (result.pos == 0 || p < result.pos)) { result.pos = p; result.tag = tags[i]; } } return result; } function extractUrls(str, startTags, endTags) { urls = ""; remaining = str; while (true) { start = findFirst(remaining, startTags); if (start.pos == 0) { return urls; } remaining = mid(remaining, start.pos); end = findFirst(remaining, endTags); if (end.pos == 0) { return urls; } if (urls != "") { urls = urls + "\n"; } urls = urls + left(remaining, end.pos + len(end.tag) - 1); remaining = mid(remaining, end.pos + len(end.tag)); } } for (y = 1; y <= Bottom; y++) { for (x = 1; x <= Right; x++) { urls = extractUrls([x,y], startTags, endTags); if (urls != "") { [x,y] = urls; } } }