Is it possible to use regex to search from end of string to beginning?
for example i have a string: "a2bba2b"
I know i need the last occurrence of /a2/ and it seems highly inefficient to make machine go trough whole string which can be quite long. I know the needle will be somewhere near the end of string(haystack), so i would like to reverse the order simply tell the script to search from end to beginning to save some resources. Regex seems like a way to go match more complicated string.And it is way easier to write complex regex than your own search function.
So is there a way maybe a flag or something to reverse searching order to match regex from end to start of input string. Does any of the modern languages support something like that? if not why?