Answer the question
In order to leave comments, you need to log in
How to cut a line in a specific div using xpath for datacol?
On the product list page, each product card has two different divs, but similar in internals, in which the same line for cutting product_rest="\d{1,}" (the first div may not have it, the second one always has it)
<div class="input_more" >
куча различных данных, включая
product_rest="16"
</div>
<div class="input_main" >
куча различных данных, включая
product_rest="1"
<div>
Answer the question
In order to leave comments, you need to log in
XPath is well suited for navigating and filtering the DOM tree. Therefore, the first part of the task - to find divs, he can solve. And then you already need to use regular expressions to cut the desired substring.
In general, XPath has functions for working with strings and regular expressions, but they do not work well. Therefore, this part needs to be implemented in your language through regular expressions by getting the contents of the div through XPath as a string.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question