Answer the question
In order to leave comments, you need to log in
How to write an XPath expression to match a string by parameters: 13 characters, and all of them are numbers?
I need to write an XPath to find an element that has 13 characters and all of them are numbers. For example,<p>319237500423184</p>
Answer the question
In order to leave comments, you need to log in
If there is a desire to write a regular expression in the framework of XPath, then most likely the problem statement is initially erroneous. In the second version of the specification, the matches function was added, but it can work differently in different implementations. In general, there should be something in the spirit:
//*[matches(., '\d{12}')]
but in this form it will not solve the problem (all ancestors from this element to the root of the document will fall). Those. the short answer is that there is no solution in XPath if you set the original problem in this way. It is better to write an example of markup from which you need to pull data and by what criteria.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question