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?
You almost had it. I removed the \ inside of the parentheses, if you want all backslashes to be captured.
(?:[^\\])[^\\]*$
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.