AnsweredAssumed Answered

How to parse out the number of pages from html code

Question asked by PeterMontague on Oct 4, 2012
Latest reply on Oct 5, 2012 by philmodjunk

Title

How to parse out the number of pages from html code

Post

     I used the following script to get the amount of pages in a book from html code:

      

     Let ( [ T = this::Child Source Code ;
               start = Position ( T ; "<li><b>Paperback:</b> " ; 1 ; 1 ) + 22 ;
               end = Position ( T ; " pages</li>" ; 1 ; 1 )
             ] ;
             Trim ( Middle ( T ; start ; end - start ) )
            )
     This worked for me while I was using paperback books. But then when hardcover books came along the script didn't work for me. Paperback worked for me because it was the first instance of the word in a long piece of code. There is a list of about 40 different formats of books which could replace paperback. Can you see any other way that I could get this script to work? Or is there a way of getting it to work for all the different formats of books?

Outcomes