Hello I was trying to use Java regular expression to get the required context path from the following path information.
String path = "/Systems/lenovo/";
I want to write regular expression to get "/Systems" and "/lenovo" separately.
I tried the following regular expression using groups but not working as expected.
String systemString = path.replaceAll("(.*)(/\\w+)([/][\\w+])", "$2") - to get "/Systems" - not working
String lenovoString = path.replaceAll("(.*)(/\\w+)([/][\\w+])", "$3") - to get "/lenovo" - working.
Could any body tell me what might be the wrong in my Regx?