this post was submitted on 12 Nov 2023
0 points (NaN% liked)
Programmer Humor
32373 readers
560 users here now
Post funny things about programming here! (Or just rant about your favourite programming language.)
Rules:
- Posts must be relevant to programming, programmers, or computer science.
- No NSFW content.
- Jokes must be in good taste. No hate speech, bigotry, etc.
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
My guess is, that someone started with a small share of features to find a simple solution for the problem, but the complexity of the problem got waaaay out of hand.
Regexes are actually used in formal computer science (if that's the right term), i.e. "proof that this and that algorithm won't deadlock" or something like that.
They're actually really elegant and can cover a lot. But you'll have to learn them by using them.
You are probably thinking of Temporal logic which allows us to model if algorithms and programs terminate etc! It can be represented by using state machines tho!
It's been a while, so I'm quite rusty, especiallyeon the terminology, but I think we modelled feasible sequences of finite and infinite state machines using regexes.
That's how I was forced to learn 'em in uni. ;)
For the purpose of algorithm verification, the final and/or pushdown automaton or probably sometimes even Turing Machines are used, because they are easier to work with. "Real" regular expressions are only nice to write a grammar for regular languages which can be easily interpreted by the computer I think. The thing is, that regexs in the *nix and programming language world are also used for searching which is why there are additional special characters to indicate things like: "it has to end with ..." and there are shortcuts for when you want that a character or sequence occurs
In "standard" regex, you would only have
So there are only 4 characters which have the same expressive power as the extended syntax with the exception of not being able to indicate, that it should occur at the end or beginning of a string/line (which could even be removed if one would have implemented different functions or options for the tools we now have instead)
So one could say that *nix regex is bloated /s