This task looks like easy but I can not solve it :(
Regex demo: https://regex101.com/r/qzIGlZ/1
As you can see, I want to copy abc3, but regex find first word var and copy all var till 3.
How to copy starting from nearest var to my key word 3?
Now it works like this: find var and copy all till 3
But I need it to work like this: find var, starts copy, but if find new var - start copy from that position.
p.s. I need solution not only for that example with "var name", I searching universal method to do "closest search starting with something and till something"
More difficult exapmles: #1 #2
p.p.s. This is NOT ONLY for JS.
