on-internet
← Community

Regex to match substring of file path

Stack Overflow ·

I am trying to write a regular expression in Perl that matches a specific part of the file path. Input string: /usr/local/bin/mybinary Output it has to match to: /usr/local/bin My regular expression is: (\ /.*\ /) It is matching /usr/local/bin/, but the / after bin should be removed.

Comments

Sign in or sign up to comment and upvote.

No comments yet.