Regex: How to search in reverse, obtaining all characters up to a specific character?
Say I have wordsandnumbers!morestuff!morelettersandnumbers, I want to get everything after the last ! (meaning there may be more than 2 !). How can I do this using regex?
You can anchor your regular expression match to the end of your string with $, and then take all the consecutive non-exclamation marks you can up to that point: