# deterministic finite automata

Published articles for deterministic finite automata.

This is one page of public article previews, not the complete archive. Follow Next page to continue. Summaries are not the original full articles.

## Minimizing the length of regular expressions, in practice

DevFeed: [Minimizing the length of regular expressions, in practice](<https://devfeed.tech/articles/minimizing-the-length-of-regular-expressions-in-practice-27405.md>)

Original publisher: [Read original article](<http://engineering.khanacademy.org/posts/shortest-regex.htm>)

Author: Khan Academy

Published: 2016-05-23T22:00:00Z

Content type: article

Language: en

Sources: [Khan Academy](<https://devfeed.tech/sources/khan-academy.md>)

Topics: [Regular expression](<https://devfeed.tech/topics/regular-expression.md>), [Optimization](<https://devfeed.tech/topics/optimization.md>), [Algorithms](<https://devfeed.tech/topics/algorithms.md>), [computational complexity](<https://devfeed.tech/topics/computational-complexity.md>), [Software Engineering](<https://devfeed.tech/topics/software-engineering.md>)

Tags: [algorithms](<https://devfeed.tech/tags/algorithms.md>), [appengine](<https://devfeed.tech/tags/appengine.md>), [deterministic-finite-automata](<https://devfeed.tech/tags/deterministic-finite-automata.md>), [engineering](<https://devfeed.tech/tags/engineering.md>), [infrastructure](<https://devfeed.tech/tags/infrastructure.md>), [interviews](<https://devfeed.tech/tags/interviews.md>), [news](<https://devfeed.tech/tags/news.md>), [questions](<https://devfeed.tech/tags/questions.md>), [regular-expressions](<https://devfeed.tech/tags/regular-expressions.md>)

### AI overview

To fit a CDN's 512-character limit while routing Khan Academy static URLs separately from dynamic ones, the author reduced a 402,025-character regex listing every file to a 294-character pattern. Combining shared prefixes cut a config-derived pattern to 824 characters, but the key step was recognizing that the regex only needed to distinguish known static paths from dynamic routes; it could match invalid URLs too, since either provider could return a 404. The shortest resulting prefixes risked misrouting future dynamic routes, so the author extended them to end at a slash. The final pattern was readable and within the limit, with a small robustness tradeoff against future route changes.

### Source excerpt

By Craig Silverstein The problem Software engineering interviews tend to be full of "algorithms" questions, because they're easy ... Read more

## What is ReDoS, and how do you fix it?

DevFeed: [What is ReDoS, and how do you fix it?](<https://devfeed.tech/articles/what-is-redos-and-how-do-you-fix-it-68006.md>)

Original publisher: [Read original article](<https://github.blog/security/how-to-fix-a-redos/>)

Author: Kevin Backhouse

Published: 2023-05-09T17:40:33Z

Content type: tutorial

Language: en

Sources: [GitHub Blog](<https://devfeed.tech/sources/github-engineering.md>)

Topics: [vulnerability management](<https://devfeed.tech/topics/vulnerability-management.md>), [Test-driven development](<https://devfeed.tech/topics/tdd.md>), [Fuzzing/Fuzz testing](<https://devfeed.tech/topics/fuzzing.md>), [Python](<https://devfeed.tech/topics/python.md>), [snyk-open-source](<https://devfeed.tech/topics/snyk-open-source.md>), [AI Chat](<https://devfeed.tech/topics/ai-chat.md>)

Tags: [agent](<https://devfeed.tech/tags/agent.md>), [android](<https://devfeed.tech/tags/android.md>), [c](<https://devfeed.tech/tags/c.md>), [c-plus-plus](<https://devfeed.tech/tags/c-plus-plus.md>), [c-sharp](<https://devfeed.tech/tags/c-sharp.md>), [code](<https://devfeed.tech/tags/code.md>), [code-scanning](<https://devfeed.tech/tags/code-scanning.md>), [codeql](<https://devfeed.tech/tags/codeql.md>), [coding](<https://devfeed.tech/tags/coding.md>), [debugging](<https://devfeed.tech/tags/debugging.md>), [denial-of-service](<https://devfeed.tech/tags/denial-of-service.md>), [deterministic-finite-automata](<https://devfeed.tech/tags/deterministic-finite-automata.md>), [dfa](<https://devfeed.tech/tags/dfa.md>), [github-security-lab](<https://devfeed.tech/tags/github-security-lab.md>), [security](<https://devfeed.tech/tags/security.md>), [vulnerabilities](<https://devfeed.tech/tags/vulnerabilities.md>), [vulnerability-research](<https://devfeed.tech/tags/vulnerability-research.md>)

### AI overview

The article explains how to diagnose and fix regular expression denial-of-service (ReDoS) vulnerabilities. It recommends reproducing the issue with a failing input, simplifying the regex while preserving the behavior, removing ambiguous repetition that causes exponential backtracking, and using fuzzing and code scanning to check the fix. Examples use Python and include a URL validation regex; the principles also apply to other languages.

### Source excerpt

Code scanning detects ReDoS vulnerabilities automatically, but fixing them isn't always easy. This blog post describes a 4-step strategy for fixing ReDoS bugs.

## Determinism and Finite Automata--A Primer

DevFeed: [Determinism and Finite Automata--A Primer](<https://devfeed.tech/articles/determinism-and-finite-automata-a-primer-40217.md>)

Original publisher: [Read original article](<https://www.jeremykun.com/2011/07/02/determinism-and-finite-automata-a-primer/>)

Published: 2011-07-02T23:41:30Z

Content type: tutorial

Language: en

Sources: [Jeremy Kun](<https://devfeed.tech/sources/jeremy-kun.md>)

Topics: [Automaton](<https://devfeed.tech/topics/automaton.md>), [function](<https://devfeed.tech/topics/function.md>)

Tags: [computability-theory](<https://devfeed.tech/tags/computability-theory.md>), [computing](<https://devfeed.tech/tags/computing.md>), [context-free-languages](<https://devfeed.tech/tags/context-free-languages.md>), [deterministic-finite-automata](<https://devfeed.tech/tags/deterministic-finite-automata.md>), [finite-state-machines](<https://devfeed.tech/tags/finite-state-machines.md>), [function](<https://devfeed.tech/tags/function.md>), [input](<https://devfeed.tech/tags/input.md>), [language](<https://devfeed.tech/tags/language.md>), [mathematics](<https://devfeed.tech/tags/mathematics.md>), [nondeterministic-finite-automata](<https://devfeed.tech/tags/nondeterministic-finite-automata.md>), [primer](<https://devfeed.tech/tags/primer.md>), [pushdown-automata](<https://devfeed.tech/tags/pushdown-automata.md>), [regular-languages](<https://devfeed.tech/tags/regular-languages.md>), [string](<https://devfeed.tech/tags/string.md>), [turing-machines](<https://devfeed.tech/tags/turing-machines.md>)

### AI overview

This primer introduces computation as a function that maps input to output, then develops a more rigorous model based on finite alphabets and strings. It explains how a computational model recognizes a language by accepting or rejecting strings.

### Source excerpt

The first step in studying the sorts of possible computations (and more interestingly, those things which cannot be computed) is to define exactly what we mean by a "computation." At a high level, this is easy: a computation is simply a function. Given some input, produce the appropriate output. Unfortunately this is much too general. For instance, we could define almost anything we want in terms of functions. Let $ f$ be the function which accepts as input the date of California Super Lotto drawings, and returns the set of winning numbers for that date.