I have been trying to make a good regular expression that catches the last name (of a file or folder) for a given path, meaning that for instance, the following path:
C:\Users\ResetStoreX\Pictures
Can be reduced to:
Pictures
What I have achieved so far is the following RE: (?:[^\\]\\)[^\\]*$
Which reduces the previous path to:
X\Pictures
Any ideas?
CodePudding user response:
You almost had it. I removed the \ inside of the parentheses, if you want all backslashes to be captured.
(?:[^\\])[^\\]*$