INNER CODE UNIT · TypeScript

urlRegex

niledatabase/niledatabase · www/app/sitemap.ts:37

      const urlRegex = /<url>(.*?)<\/url>/gs;
      const locRegex = /<loc>(.*?)<\/loc>/;
      const lastmodRegex = /<lastmod>(.*?)<\/lastmod>/;

      let match;
      while ((match = urlRegex.exec(xml)) !== null) {
        const urlBlock = match[1];
        const locMatch = locRegex.exec(urlBlock);
        const lastmodMatch = lastmodRegex.exec(urlBlock);

        if (locMatch && locMatch[1]) {
          let url = locMatch[1];
          // Ensure www.thenile.dev
          url = url.replace('https://thenile.dev', 'https://www.thenile.dev');

          docsPages.push({
            url,
            lastModified: lastmodMatch ? new Date(lastmodMatch[1]) : new Date(),

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…