You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by Be...@sungard.com on 2012/05/21 15:10:16 UTC
Regular Expression multi line
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* Benedict.nkosi@sungard.com<ma...@sungard.com> * www.sungard.com<http://www.sungard.com/iam>
SunGard has been named "Best Buy Side Technology Provider of the Year<http://www.sungard.com/pressreleases/2010/finsystemsaward110910.aspx>" in the [Description: cid:593573612@18112010-24D6] <http://www.sungard.com/pressreleases/2010/finsystemsaward110910.aspx>
[Description: TEN]<http://www.sungard.com/ten>
Join SunGard's customers, partners and industry experts at www.sungard.com/ten<http://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
RE: Regular Expression multi line
Posted by Be...@sungard.com.
Found the solution
(?s)ViewState" value="(.+?)"
Thanks and kind regards
Benedict Nkosi * Performance Tester * SunGard
From: Benedict.Nkosi@sungard.com [mailto:Benedict.Nkosi@sungard.com]
Sent: Monday, May 21, 2012 3:10 PM
To: user@jmeter.apache.org
Subject: Regular Expression multi line
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* Benedict.nkosi@sungard.com<ma...@sungard.com> * www.sungard.com<http://www.sungard.com/iam>
SunGard has been named "Best Buy Side Technology Provider of the Year<http://www.sungard.com/pressreleases/2010/finsystemsaward110910.aspx>" in the [Description: cid:593573612@18112010-24D6] <http://www.sungard.com/pressreleases/2010/finsystemsaward110910.aspx>
[Description: TEN]<http://www.sungard.com/ten>
Join SunGard's customers, partners and industry experts at www.sungard.com/ten<http://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
Re: Regular Expression multi line
Posted by ZK <st...@gmail.com>.
ViewState" value="(.*?)"
ZK
--
View this message in context: http://jmeter.512774.n5.nabble.com/Regular-Expression-multi-line-tp5712896p5712913.html
Sent from the JMeter - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org
Re: Regular Expression multi line
Posted by oliver lloyd <ol...@hotmail.com>.
For the thread, using [^"]+ is better than .*? because there's less backtracking, it's more precise and generally less lazy. Also, in your case you should also note that the tilda notation will match newlines better than .*
On 21 May 2012, at 14:38, oliver lloyd wrote:
> 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, <Be...@sungard.com> <Be...@sungard.com> 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• Benedict.nkosi@sungard.com • 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
>>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@jmeter.apache.org
For additional commands, e-mail: user-help@jmeter.apache.org
Re: Regular Expression multi line
Posted by oliver lloyd <ol...@hotmail.com>.
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, <Be...@sungard.com> <Be...@sungard.com> 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• Benedict.nkosi@sungard.com • 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
>