RegExpressionprüfung Ganzzahl 1-365
Hallo,
ich verzweifle mal wieder mit RegExtensions....Wenn da mal einer eine RegEX-Builder bauen würde...HURRA!!
Folgendes: ich brauch die Prüfung für "1 Tag bis 365 Tage" (also positive Ganzzahl 1-365, 1bis 3 Stellen lang, führende Nullen können weg bleiben)
Würde da so rangehen:
Aber damit geht eben auch "399". Das ist natürlich Mist. genauso wie "99" nicht geht aber "099" geht. Hmmm...
Habt ihr da eine Lösung? Merci!!!
ich verzweifle mal wieder mit RegExtensions....Wenn da mal einer eine RegEX-Builder bauen würde...HURRA!!
Folgendes: ich brauch die Prüfung für "1 Tag bis 365 Tage" (also positive Ganzzahl 1-365, 1bis 3 Stellen lang, führende Nullen können weg bleiben)
Würde da so rangehen:
^[0-3][0-9][0-9]{0,3}$
Habt ihr da eine Lösung? Merci!!!
4 Antworten
- LÖSUNG saggi20 schreibt am 04.12.2020 um 09:04:31 Uhr
- LÖSUNG DocuSnap-Dude schreibt am 04.12.2020 um 09:11:28 Uhr
- LÖSUNG Lochkartenstanzer schreibt am 04.12.2020 um 10:19:44 Uhr
- LÖSUNG 146707 schreibt am 04.12.2020 um 12:08:20 Uhr
- LÖSUNG Lochkartenstanzer schreibt am 04.12.2020 um 10:19:44 Uhr
- LÖSUNG DocuSnap-Dude schreibt am 04.12.2020 um 09:11:28 Uhr
LÖSUNG 04.12.2020 um 09:04 Uhr
LÖSUNG 04.12.2020 um 10:19 Uhr
LÖSUNG 04.12.2020, aktualisiert um 12:09 Uhr
Zitat von Lochkartenstanzer:
Hast Du auch den Lösungsweg verstanden oder hält das nur bis zum nächsten Problem?
Dem Teaser seines Profils zu urteilen, eher letzteres Hast Du auch den Lösungsweg verstanden oder hält das nur bis zum nächsten Problem?
^([1-9]|[1-9][0-9]|[1-2][0-9]{2}|3[0-5][0-9]|36[0-5])$
Assert position at the beginning of a line (at beginning of the string or after a line break character) (line feed) «^»
Match the regex below and capture its match into backreference number 1 «([1-9]|[1-9][0-9]|[1-2][0-9]{2}|3[0-5][0-9]|36[0-5])»
Match this alternative (attempting the next alternative only if this one fails) «[1-9]»
Match a single character in the range between “1” and “9” «[1-9]»
Or match this alternative (attempting the next alternative only if this one fails) «[1-9][0-9]»
Match a single character in the range between “1” and “9” «[1-9]»
Match a single character in the range between “0” and “9” «[0-9]»
Or match this alternative (attempting the next alternative only if this one fails) «[1-2][0-9]{2}»
Match a single character in the range between “1” and “2” «[1-2]»
Match a single character in the range between “0” and “9” «[0-9]{2}»
Exactly 2 times «{2}»
Or match this alternative (attempting the next alternative only if this one fails) «3[0-5][0-9]»
Match the character “3” literally «3»
Match a single character in the range between “0” and “5” «[0-5]»
Match a single character in the range between “0” and “9” «[0-9]»
Or match this alternative (the entire group fails if this one fails to match) «36[0-5]»
Match the character string “36” literally «36»
Match a single character in the range between “0” and “5” «[0-5]»
Assert position at the end of a line (at the end of the string or before a line break character) (line feed) «$»