jeff king jeff king - 9 months ago 31
HTML Question

Regex scrape of the same form_id name but different values

I would like to know using either regex or xpath how can you scrape a form id value from a html page that has the same form_id names example below, I would to scrape the value from the 2nd form_id name any advice for the best way to achieve this using only regex or xpath? Thanks

<input type="hidden" name="form_id" value="search_block_form" />

I would like to scrape the value from this form_id below: "webform_client_form_"

<input type="hidden" name="form_id" value="webform_client_form_" />


Targeting second input with XPath:


Using utilities that work on DOM structure is the preferable choice here.