Regex to remove what ever comes in front of “\” using powershell

Question:

wanted one help, wanted a regex to eliminate a “\” and what ever come before it,

Answer:


removes any non-backslash characters at the start of the string, followed by a backslash:

Explanation:


This means that if there is more than one backslash in the string, only the first one (and the text leading up to it) will be removed. If you want to remove everything until the last backslash, use

Source:

Regex to remove what ever comes in front of “\” using powershell by licensed under CC BY-SA | With most appropriate answer!

Leave a Reply