{
  "id": 20984897,
  "title": "Stop regex-ing the LLM's prose",
  "url": "https://urgent.news/2026/11/21/stop-regex-ing-the-llms-prose",
  "topic": "ai",
  "section": "AI",
  "published": "2026-11-21T02:43:16.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/phpboyscout/stop-regex-ing-the-llms-prose-53go"
  },
  "original_language": "en",
  "account": "When you ask an LLM for a response, you receive a paragraph of text. While it's easy to read, it's difficult to program against. You may be searching for a specific word buried within paragraphs that vary each time you use the model. The solution lies in asking the LLM for structured data rather than paragraphs of text. This approach eliminates the need for regular expressions and enables you to build upon the LLM's responses more effectively.\n\nTo accomplish this, the LLM is asked to return a value with specific fields, such as severity and fix. For example, a Go struct can be defined with these fields. A framework can then generate a JSON schema from this struct and send it to the model as the required response format. When the model sends back a response, it is automatically unmarshalled into the struct, giving you typed, ready-to-use data.\n\nThe key to this approach is that the struct acts as the schema, ensuring that the model's response matches the expected structure. This prevents the need to constantly update schemas or handle mismatches between the schema and the actual response. By using this method, an LLM becomes a reliable source of structured data that can be consumed by programs, leading to more robust and maintainable code.",
  "summary": "Ask an LLM a question and it hands you back prose. Lovely to read, miserable to program against. You wanted the one number buried in the middle of it, and now you're writing a regular expression to fish a word out of three well-written paragraphs that phrase themselves slightly differently every single time you run them. There's a much better way, and it's the difference between forever…",
  "key_points": [
    "Ask LLM for structured data instead of paragraphs",
    "Define Go struct with specific fields like severity and fix",
    "Model response is automatically unmarshalled into struct"
  ],
  "editors_take": "Shifting from prose to structured data through schema-driven responses transforms large language models from unpredictable text generators into reliable, programmable components for building robust and maintainable software systems.",
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}