Skip to content

Commit

Permalink
fix: fix regex
Browse files Browse the repository at this point in the history
  • Loading branch information
uhidontkno committed May 7, 2024
1 parent f9388b9 commit 00a731d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/commands/check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export default class FilterCheckCommand extends Command {
async run(ctx: CommandContext) {
const re = new RegExp("^(?:https?:\/\/)?(?:www\.)?([^\/]+)");
// @ts-ignore
let url = re.exec(ctx.options.url)[0];
let url = re.exec(ctx.options.url)[1];

const embed = new Embed();
embed.setColor('Green')
Expand Down
6 changes: 3 additions & 3 deletions testing/autocheck.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ import { stdin } from "bun";
import filters from "../src/modules/filters.ts";
let inp:any = await stdin.text()
inp = inp.split("\n")
const re = new RegExp("^(?:https?:\/\/)?(?:www\.)?([^\/]+)");
const re = new RegExp("(?:https?://)?([^/]+)");

for (let i = 0; i < inp.length; i++) {
for (let i = 0; i < (inp.length - 1); i++) {
// @ts-ignore
let url = re.exec(inp[i])[0];
let url = re.exec(inp[i])[1];
let results = [await filters.fortiguard(url),await filters.lightspeed(url),await filters.palo(url)]
results[2] = [results[2][0].replaceAll(" ","").replaceAll("\n",""),results[2][1]]
console.log(`\n${url}:\n lightspeed: ${results[1]}\n forti: ${results[0]}\n palo: ${results[2]}`)
Expand Down

0 comments on commit 00a731d

Please sign in to comment.