For me, Regex and Perl are write-only languages. I can't debug, edit or even read regex – I just rewrite it from scratch with some tool like RegExr or something. For me, a person who can memorise all that syntax is definitely a superhuman.
Making code readable is half the job of the coder. It's also true for regexes, which means you have to look for ways to separate parts and comment your regexes (or at least name the groups).
Fortunately, you can find solutions in most languages. Here are two examples from some of my OS codes:
For me, Regex and Perl are write-only languages. I can't debug, edit or even read regex – I just rewrite it from scratch with some tool like RegExr or something. For me, a person who can memorise all that syntax is definitely a superhuman.
Making code readable is half the job of the coder. It's also true for regexes, which means you have to look for ways to separate parts and comment your regexes (or at least name the groups).
Fortunately, you can find solutions in most languages. Here are two examples from some of my OS codes:
In Javascript:
(I think there are JS libs to do that without taking my code, now)
In rust:
(this is the standard way in this language)