This should work for you:

ViewState"\s+value="([^"]+)"

That will match everything up until it finds a double quote.


On 21 May 2012, at 14:10, <[email protected]> 
<[email protected]> wrote:

> Hi all,
>  
> I’m trying to capture the viewstate from the following string, I can get 
> Viewstate 1 using this expression: ViewState" value ="(.+?).*\n.*\n.*=. The 
> problem is sometimes the viewstate looks like Viewstate 2 which doesn’t work 
> with the expression used for viewstate 1.
>  
> I need a regular expression that can capture both viewstates.
>  
> Viewstate 1
> .ViewState" 
> value="X/1VbnbiXDKhgR7HK5nAmnu5wDby5W1+Y15i3391HltpvvUrx2aIiHOXPp6dRcWUQxodiIr7meVj
> ZSRBx/lQzmYmWCucNmJpVUZAR9MX0Nc6KSKZDwLpLx4LZOtY6R5ZBaxSiKuQKUBLsUAqf/8cdn3V
> aKA=
> " /></form></td></tr>
>  
> Viewstate 2
> ViewState" 
> value="X/1VbnbiXDKhgR7HK5nAmnu5wDby5W1+Y15i3391HltpvvUrx2aIiOWX1WbcS/UMcDdS/3ZkHzE8
> 3m4KUlHpOyquAgCxVSoAlFfneVL8lyJFUnrVyIlW2DTcunzlMnkg7UZTuDS5bXf110AB
> " />
>  
> Thanks and kind regards
>  
> Benedict Nkosi • Performance Tester • SunGard • Asset Arena • Services 
> Initiative • 2nd Floor, Block A, North Park Building, Black River Park, Fir 
> Street, Observatory, Cape Town, 7925 • Tel +27 (0)21 486 7732 • Mobile 
> +27718988394• [email protected] • www.sungard.com
>  
> SunGard has been named "Best Buy Side Technology Provider of the Year" in the 
>  
>  
> 
> 
> Join SunGard's customers, partners and industry experts at 
> www.sungard.com/ten to discuss how the need for more Transparency, Efficiency 
> and Networks is changing our industry and to register for a city day event 
> near you.
> DUBAI FRANKFURT HONG KONG JOHANNESBURG LONDON MUMBAI NEW YORK PARIS SAO PAULO 
> SEOUL SHANGHAI SINGAPORE SYDNEY TOKYO TORONTO
> 
> CONFIDENTIALITY: This e-mail (including any attachments) may contain 
> confidential, proprietary and privileged information, and unauthorized 
> disclosure or use is prohibited.  If you receive this e-mail in error, please 
> notify the sender and delete this e-mail from your system
>  

Reply via email to