Urgent.News

What's breaking now, across thousands of outlets.

Tech

Making legacy regexes readable — without changing what they match

A pattern like this ships in real projects every day: ^(?\[(?:[A-Za-z0-9_.-]+)\])|^(?[A-Za-z_][A-Za-z0-9_]*)\s*=\s*(?"(?:[^"\\]|\\.)*"|'(?:[^'\\]|\\.)*'|[^#\n]*)\s*(?:#.*)?$ An INI-line parser: a section header or a key–value pair, three quoting modes for the value, trailing comments. Perfectly readable — to the person who wrote it, today. Come back in three months, or hand it to a teammate, and…

Legacy regular expressions can be difficult to understand due to their complex structure. For example, a pattern like `^(?(\[?:[A-Za-z0-9_.-]+)\])|^([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(?:[^ \\]|\\.)* | (?:[^ \\]|\\.)* |[^#\n]*)\s*(?:#.*)?$` appears frequently in projects. This INI-line parser has three quoting modes for the value, trailing comments, and perfect readability for the creator.

However, returning to the pattern after some time or sharing it with a teammate reveals that it is unclear what it actually matches. Formatting the regex in a readable way solves this issue, just as it does in other programming languages.

The Format panel in RegexTester.dev offers three modes: Pretty, Annotated, and Minify. By enabling the x / extended flag, the formatter emits output with free-spacing layout and indented groups, making it easier to read. The panel ensures that the layout does not change the behavior of the regex by emitting its output with the x flag enabled and verifying that the output behaves identically to the original pattern.

The formatter goes through a round-trip proof and behavior check to confirm that the formatting does not alter the regex's functionality. This tool allows users to format their complex regular expressions and verify that the changes made are purely typographic.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Prestigious Technion Alumni Medal Awarded to IAI Chairman Boaz Levy

The prestigious medal recognizes Technion alumni for exceptional achievements, leadership, and contributions to science, technology, industry, and society.

  • Boaz Levy, IAI Chairman, receives Technion Alumni Medal on October 26.
  • Medal awarded for exceptional achievements in science, technology, and leadership.
  • Levy led IAI to record order backlogs and financial performance since 2020.

Gobernanza de Contratos y Evolución de Esquemas en Kafka: Prevención de Corrupción de Datos con Avro y Schema Registry

A las 03:14 AM, el pipeline de procesamiento de órdenes en tiempo real de una plataforma de comercio B2B global procesó silenciosamente un millón de eventos OrderCreated con un campo numérico…

  • One million OrderCreated events processed in real-time pipeline
  • Numeric field relocated from integer to string without exceptions
  • Financial discrepancies of multiple million dollars due to data corruption

How I built a countdown & days-since tracker with React 19, Supabase and Vercel

I wanted a place to count down to things – a trip, a birthday, a deadline – and to count up from things, like the day I started a habit.

  • Created CountMyDays to count down to events or days since starting habits
  • Built with React 19, Vite, TypeScript, Supabase, Vercel, Tailwind, and service worker
  • Data syncs between guests and signed-in users via Supabase, with accurate timer using date math

How I added English to my solo-dev Unity MMO without touching 130 UI files

My game, Battle of Pirates , is a free online pirate MMO for Windows: real-time naval PvP, fleets, fortress sieges, boss events.

  • Translated text after display, no server modifications needed
  • Skipped input fields to avoid translating player typing
  • English toggle added to login screen, patch released through launcher

More from Monday 26 October →