I am trying to extract Viewstate value from an HTML page that could come in two different ways:
First:
Blah and bleh
Some tags and stuff here that can be ignored
some more garbage and now important stuff .. id="__VIEWSTATE" value="ThisIsWhatIWantToExtract" />
garbage
Second:
Blah and bleh
Some tags and stuff here that can be ignored
some more garbage and now important stuff .. |__VIEWSTATE|ThisIsWhatIWantToExtract|garbage
garbage
I was using .split('__VIEWSTATE') method before I realized it could come two ways. This is whhat I have tried:
(.*\"__VIEWSTATE\" value\=\"(.*)\" \/\>.*)|(.*\|__VIEWSTATE\\|(.*)\|.*)
It seems to working for the first case but doesnt work for second case.
Whats the most effiecient and right way to do this?