Hacker News new | ask | show | jobs
by fouc 1915 days ago
Any Regular Expression can be represented as a Finite State Machine. Knowing this, I usually look at things like this because I'm hoping that someday someone will come up with a new concise & readable way of writing both regular expressions and finite state machines.
4 comments

For sure, and one of the best uses of theory out in the real world is showing someone when their design can't be handled by regular expressions because they designed a non-finite state machine.

Just a weird thing that I have more than once had to do this in my career when someone dictated something had to be done with regular expressions when the requirements were for something that regular expressions were incapable of.

Generally a fight every time.. the people dictating regular expressions as the solution are picking it as a solution because they fundamentally don't understand the difference between finite/non-finite automata, mostly because there are way too many CS degree programs that award Bachelor's degrees without teaching undergrads what the difference is between a DFA, NFA, and a turing machine.

Regular Expression in formal language theory sense can be represented as FSM's.

Many real world string pattern matching engines (regexes) implement features that can't be expressed using regular languages. Backreferences or any context sensitive extensions are not really regal expressions in that sense.

https://twitter.com/happyautomata explores this space quite nicely
I have always hope for that, RegEx syntax is not human and terrible.