Regex Last occurrence?

2020-01-24 07:25发布

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.

[Regexer Demo]

标签: regex path
7条回答
够拽才男人
2楼-- · 2020-01-24 07:51

You can try anchoring it to the end of the string, something like \\[^\\]*$. Though I'm not sure if one absolutely has to use regexp for the task.

查看更多
登录 后发表回答