It explains all parts of your regex and highlights all matches in your example text. I usually add a comment to a regex101 playground if I use a regex in code.
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.
Regex is actually just a way to write (Epsilon) non determistic state automata(ε-NDA) using text! ε-NDA comes from automata theory and they are just a somewhat powerful way to describe state machines!
They can kind of be seen as a stepping stone to things like Context-Free Grammars which is what language parsers use to define their language/parsers, and Turing machines! Regex is a fundamental part of computer science, and they are of course incredibly useful in string validation due to their expressive power!
If you study at uni and get the chance to take a course in automata theory I recommend it! Personal favorite subject :)
It's pattern-matching. Like searching *.txt to get all text files. It's just... more. There's symbols for matching the start of a string, the end of a string, a set of characters, repetition, etc. Very "etc." And the syntax blows. The choices of . for match-any-character and * for zero-or-more really fuck with common expectations.
It can also replace substrings that match. Like changing the file extension of all text files. Where it gets properly difficult is in "capture groups." Like looking for all file extensions, and sticking a tilde after the dot. You can put parentheses around part of the pattern being matched and then reference that in the replacement. Conceptually simple - pain in the ass to use properly - syntax both sucks and blows.
Lookahead is what you do to match "ass" but not "assault." I refuse to elaborate further.
I don't agree that AI has no uses, you just have to know when to use it. There are multiple times I have scoured documentation and official forums of a niche tool to few results only to ask ChatGPT and get far closer to my goal in 2 minutes than I did in 30. I know the AI has to be getting that info from somewhere, but if Google, Reddit, and a forum search can't find it then I am sorry but I am going to ask an AI.
I got the “error in moderation” today today too when I asked it to make me a ghost with the beard and body type of Santa Claus. Like it knows Santa is not a real person right?