intanto puoi estrappolarti tutto il contenuto che c'è tra <form> e </form>. Da lì, tramite regex, puoi ricavarti le righe che ti interessano