Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove or replace some text from XPath string

Tags:

xpath

Is it possible to remove or replace text on XPath string?

Using XPath I get url with http://www and I want to remove http://www, so the same XPath query would return me only a link without http://www. I can't find anything about removing or replacing Xpath string.

Is it possible? If so, how to do this?

like image 938
Simon Avatar asked Feb 07 '16 20:02

Simon


1 Answers

Have you tried substring-after?

substring-after('http://www.stackoverflow.com', 'http://www.')

Example:

<demo>http://www.stackoverflow.com</demo>

XPath:

//demo/substring-after(., 'http://www.')

Yields:

stackoverflow.com

Check online demo here.

like image 102
acdcjunior Avatar answered Oct 17 '22 23:10

acdcjunior