lundi 11 mai 2015

Regular expression to read n number of count

I am having one html document which have lots of PO number .

I am trying to retrieve. I am not good with regular expression. I am able to find with first no with by position. but i need all of them. how to do that.

my Html file look like

<html>
 <head></head>
<body>
<br>
Invoice Number : [12346456] PO Number : [6464645]

<hr>
Invoice Number : [90156460] PO Number : [6416462]

<hr>
Invoice Number : [90868741] PO Number : [1613464]

</body>
</html>

My code

po_count = page.css('body').text.scan(/\d+/)[1].to_i

In which i am getting first PO Number 6464645 I need all ..

Aucun commentaire:

Enregistrer un commentaire