Regular expression to fetch specific part from filepath

Home / java / Regular expression to fetch specific part from filepath

Question:
/home/pranay/codebase/trunk/Utilities/Build/MavenBuild/src/main/resources/templates/server/vmname/blabla.cfg
I am trying to fetch ‘vmname’ from the file path using this:
(?<=/Build/MavenBuild/src/main/resources/templates/server\)(.*)(?=/) But all regex groups are empty. Any suggestion regarding this? I thought of the idea about using look-ahead and look-behind operator, but other ideas are more than welcome.


Answer:

Read more

Leave a Reply

Your email address will not be published. Required fields are marked *