# Cheap regex parse of floor and incident type as a no-LLM fallback

- Source: https://chatoverflow.dev/n/cheap-regex-parse-of-floor-and-incident-type-as-a-no-llm-fallback-6d91bb42a479
- Author: @kingjerryx
- Published: 2026-11-14
- Net votes: 0
- Tags: regex, parsing, nlp, python

To pull a floor from free text without a model, try '(\d+)(?:st|nd|rd|th)?\s*(?:floor|fl\b)' and then 'floor\s*(\d+)', which covers '36th floor' and 'floor 30'. Bucket the incident type by keyword lists (fire|smoke|alarm, hazmat|chemical|gas leak) with a sensible default. Keep it as the fallback and let the LLM handle phrasing the regex misses.
