Skip to content

Commit

Permalink
improve form regex
Browse files Browse the repository at this point in the history
  • Loading branch information
Belissimo-T committed Mar 10, 2024
1 parent 6e28848 commit a2fab17
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions backend/vplan_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,21 @@
_parse_form_pattern = re.compile(
r"(?<!\S)(?:"
r"(?P<major>\d{1,2}(?!\d)|[A-Za-zÄÖÜäöüß]+(?![A-Za-zÄÖÜäöüß]))"
r"(?P<sep>[/.] |[^A-Za-zÄÖÜäöüß0-9() \n]?)"
r"(?P<minor>(?:\d{1,2}[A-Za-zÄÖÜäöüß]?|[A-Za-zÄÖÜäöüß]+?)(?:,(?:\d{1,2}[A-Za-zÄÖÜäöüß]?|[A-Za-zÄÖÜäöüß]+?))*)"
r"|(?P<alpha>\d{1,2})"
r"(?P<sep> |[/._]|[^A-Za-zÄÖÜäöüß0-9() \n]?)(?:(?<! ) )?"
r"(?P<minor>"
r"(?:\d{1,2}[A-Za-zÄÖÜäöüß]?|[A-Za-zÄÖÜäöüß]+\d{0,2})"
r"(?:,(?:\d{1,2}[A-Za-zÄÖÜäöüß]?|[A-Za-zÄÖÜäöüß]+\d{0,2}))*"
r")|(?P<alpha>\d{1,2})"
r")(?![^\s,:])"
)
_loose_parse_form_pattern = re.compile(
r"(?<!\S)(?:"
r"(?P<major>\d{1,2}(?!\d)|[A-Za-zÄÖÜäöüß]+(?![A-Za-zÄÖÜäöüß]))"
r"(?P<sep>[/.]? |[^A-Za-zÄÖÜäöüß0-9() \n]?)"
r"(?P<minor>(?:\d{1,2}[A-Za-zÄÖÜäöüß]?|[A-Za-zÄÖÜäöüß]+?)(?:,(?:\d{1,2}[A-Za-zÄÖÜäöüß]?|[A-Za-zÄÖÜäöüß]+?))*)"
r"|(?P<alpha>\d{1,2})"
r"(?P<sep> |[/._]|[^A-Za-zÄÖÜäöüß0-9() \n]?)(?:(?<! ) )?"
r"(?P<minor>"
r"(?:\d{1,2}[A-Za-zÄÖÜäöüß]?|[A-Za-zÄÖÜäöüß]+\d{0,2})"
r"(?:,(?:\d{1,2}[A-Za-zÄÖÜäöüß]?|[A-Za-zÄÖÜäöüß]+\d{0,2}))*"
r")|(?P<alpha>\d{1,2})"
r")(?![^\s,:()])"
)

Expand Down

0 comments on commit a2fab17

Please sign in to comment.