I'm trying to catch the last part after the last backslash
I need the \Web_ERP_Assistant
(with the \
)
My idea was :
C:\Projects\Ensure_Solution\Assistance\App_WebReferences\Web_ERP_WebService\Web_ERP_Assistant
\\.+?(?!\\) // I know there is something with negative look -ahead `(?!\\)`
But I can't find it.
What about this regex:
\\[^\\]+$
One that worked for me was:
Try it online!
Explanation:
A negative look ahead is a correct answer, but it can be written more cleanly like:
This looks for an occurrence of \ and then in a check that does not get matched, it looks for any number of characters followed by the character you don't want to see after it. Because it's negative, it only matches if it does not find a match.
I used below regex to get that result also when its finished by a
\
[Regex Demo]
If you don't want to include the backslash, but only the text after it, try this:
([^\\]+)$
or for unix:([^\/]+)$
Your negative lookahead solution would e.g. be this:
See it here on Regexr