While useful to some I think advanced RE are like mixing in Perl or playing code golf with production code. They tend to make code harder to read. My preference in such cases is for multiple separated or longer REs (which can be at least split in the surrounding code) and each part named or heavily commented. Of course it's always worthwhile to consider non-RE solutions if the problem can be broken down enough. EDIT:…
I agree. Usually, I end up leaning on PEGs instead: https://nim-lang.org/docs/pegs.html
import pegs
echo "xzxy" =~ peg"""
B
Stack overflowNim needs to let go of its toy parsing algorithm.