Test, validate and match regular expressions
This regex matches the entire string up to and including the last backslash character. It uses a greedy dot-star to consume as many characters as possible before requiring a backslash, effectively capturing the prefix up to the final backslash. Common use cases include extracting directory paths from file paths or isolating the path component before the filename.