I want to extract one string from URL and seeking your help to find the regex for the same .
String is [http://somewebsite.come/v1/dataRes/54d7898-dfa9-4f5b-a23e-34575g678d5] I want to extract last part opf the URL which is:54d7898-dfa9-4f5b-a23e-34575g678d5
Right now I am doing a lot of hard coded which does not look good . Can anyone suggest a better approach ?
List<String> test = headersStr.get("keyLoc");
System.out.println(test.toString()); // Prints [http://somewebsite.come/v1/dataRes/54d7898-dfa9-4f5b-a23e-34575g678d5]
String[] strArr = test.toString().substring(7,test.toString().length() - 1).split("/");
String profileId = strArr[4];
System.out.println("Profile Id :"+profileId);