From 95081cb010f1aaf599c498306d0ee3afb4f577e5 Mon Sep 17 00:00:00 2001 From: Jan Date: Sun, 7 Jan 2024 11:36:28 +0100 Subject: [PATCH] =?UTF-8?q?FINAlY=20Regex=20f=C3=BCr=20alle=20optionen?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hs_mannheim/informatik/spreadsheet/Axel.java | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/Axel/src/de/hs_mannheim/informatik/spreadsheet/Axel.java b/Axel/src/de/hs_mannheim/informatik/spreadsheet/Axel.java index 831f11a..c2d20a0 100644 --- a/Axel/src/de/hs_mannheim/informatik/spreadsheet/Axel.java +++ b/Axel/src/de/hs_mannheim/informatik/spreadsheet/Axel.java @@ -18,7 +18,15 @@ public class Axel { spr.put("A3", "123"); spr.put("B9", "=41+A2+10-2/3"); - spr.put("B9", "2"); + spr.put("B8", "2"); + spr.put("B7", "20"); + spr.put("B6", "42"); + spr.put("B5", "23"); + spr.put("B4", "24"); + spr.put("B3", "24"); + spr.put("B2", "28"); + spr.put("B1", "24"); + System.out.println("Schreibe 'stop' zum anhalten."); do{ @@ -29,7 +37,10 @@ public class Axel { System.out.println(spr); System.out.println("Befehl (z.B. D4_=7*6): "); command = input.nextLine(); - if(command.matches("[A-Za-z][1-9][0-9]?_=((([A-Za-z][1-9][0-9]?)|([0-9]+))(\\*|\\+|\\-|\\/))*(([A-Za-z][1-9][0-9]?)|([0-9]+))")) { + if(command.matches("[A-Za-z][1-9][0-9]?_=" + + "((((([A-Za-z][1-9][0-9]?)|([0-9]+))(\\*|\\+|\\-|\\/))*" + + "(([A-Za-z][1-9][0-9]?)|([0-9]+)))|" + + "((SUMME|PRODUKT|MID|STABW|MIN|MAX)\\(([A-Za-z][1-9][0-9]*\\:[A-Za-z][1-9][0-9]*)\\)))")) { for(int i = 0; i