Re: Regex - Capture everything before final backslash, but..
Posted 19 August 2011 - 03:32 PM
Well the first pattern you can try is... \..*\/. What this is saying is find the part of the text which starts with a period and has any number of characters but ends with a forward slash. This will match all the way to the last forward slash because regex is naturally "Greedy". It will always want the biggest match and pass up the smaller matches.
The result will typically contain the last forward slash, so if you need to chop that, you can simply remove the last character off the result match.