I'm kinda new to regex, so I have the following string:
[[ChromeDriver: chrome on LINUX (ff108507ea7a3598104c728cc453f299)] -> xpath: /html[1]/body[1]/div[3]/div[1]/header[1]/div[1]/div[1]/div[1]/div[1]/nav[1]/ul[1]/li[1]/a[1]] (class: sf-depth-1 menuparent ext sf-with-ul)
I want to know how I can remove everything before the /html
, so I end up with the following string:
/html[1]/body[1]/div[3]/div[1]/header[1]/div[1]/div[1]/div[1]/div[1]/nav[1]/ul[1]/li[1]/a[1]] (class: sf-depth-1 menuparent ext sf-with-ul)
I tried this but without success:
Pattern pattern = Pattern.compile("/html.*");
Matcher matcher = pattern.matcher(absoluteXpath);
if (matcher.find()) {
System.out.println(matcher.group(1));
}
Tested here: