Answer the question
In order to leave comments, you need to log in
How to get a number from a string using xpath?
Good afternoon.
How to get a number from a string using xpath?
<td><div>ИНН: 0123456789</div></td>
Now I'm looking like this, but in the end I get the whole line and I have to apply another regular expression to clean it up.
tree.xpath("//td/div/text()")
Can eat a variant to apply in xpath the regular expression?
I did not find anything suitable in the manual. Or, I'm using it wrong.
https://devhints.io/xpath
Answer the question
In order to leave comments, you need to log in
Maybe something like that ?
Not the cleanest code, and most likely not the most correct option, but this is the first thing that came to mind...
Corners use before and after pseudo elements that are absolutely positioned. The .box__cont element is needed to overlap elements with an absolute and to decorate the text.
https://jsfiddle.net/2fa29uw8/
https://cloud.mail.ru/public/H1mJ/RNt4ibAVP here is a link to the layout and a screen attached - the path in the address bar of the browser I think you will not deceive
As an option codepen.io/anon/pen/KzojNW
PS but I would make up pictures :)
<td><div>ИНН: 0123456789</div></td>
If you parse exactly html, then I highly recommend to score on xpath and use Beautiful Soup and CSS selectors. The ability to match, including regular expressions, is just one of many nice goodies Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question