mirror of
https://github.com/theoleuthardt/werkzeugkiste.git
synced 2026-06-13 09:37:53 +00:00
no comments needed
This commit is contained in:
parent
544ebaa7cf
commit
fd4103240a
1 changed files with 1 additions and 5 deletions
|
|
@ -18,12 +18,10 @@ export async function regexTest(app: FastifyInstance) {
|
|||
return reply.status(400).send({ error: "No Regex declared!" });
|
||||
}
|
||||
|
||||
// Überprüfe, ob die Felder regex und test vorhanden sind
|
||||
if (!data.regex || !data.test) {
|
||||
return reply.status(400).send({ error: "Regex or test string missing!" });
|
||||
}
|
||||
|
||||
// Versuche, den regulären Ausdruck zu erstellen
|
||||
let regexPattern;
|
||||
try {
|
||||
regexPattern = new RegExp(data.regex);
|
||||
|
|
@ -31,10 +29,8 @@ export async function regexTest(app: FastifyInstance) {
|
|||
return reply.status(400).send({ error: "Invalid regular expression!" });
|
||||
}
|
||||
|
||||
// Teste den Eingabestring gegen das Regex
|
||||
const result = regexPattern.test(data.test);
|
||||
|
||||
// Erstelle die Antwort basierend auf dem Testergebnis
|
||||
|
||||
let output = "";
|
||||
if (result) {
|
||||
output = `The input matches the regular expression!`;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue