jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Flavio Cysne <flaviocy...@gmail.com>
Subject Re: Regular expressions: need help
Date Fri, 12 Apr 2013 11:41:31 GMT
Unfortunately "regardless of its position in the list" is wrong. It'll work
if "id" comes before another literal object declaration inside the list.

These two examples below works, but need to be sure that the "id" you want
is the first one in the message.

[,|{]?"id":(\w+)[,|}]?
"id":(\w+)


If you need to guarantee it'll get the right one, I suggest you to use a
JSON parser, maybe inside a Beanshell Post-processor.



2013/4/12 Flavio Cysne <flaviocysne@gmail.com>

> Tested in Regular Expression Tester (Firefox
> Addon): "list":\[\{[^}]*,?"id":(\w+),?[^}]*
>
> Thia Regex will get the "id" value regardless of its position in the list
>
> Hope it helps
>
>
> 2013/4/12 Dzmitry_Kashlach <dzmitrykashlach@gmail.com>
>
>>  Hi,
>>
>>     I have the following response message:
>>
>>
>> {"message":"","cod":"200","type":"base","calctime":"","units":"internal","count":1,"list":[{"id":625144,"coord":{"lat":53.900002,"lon":27.566668},"name":"Minsk","main":{"temp":283.15,"pressure":1012,"humidity":53,"temp_min":274.8,"temp_max":283.15},"dt":1365759000,"date":"2013-04-12
>>
>> 09:30:00","wind":{"speed":5,"deg":160,"var_beg":130,"var_end":190,"gust":9},"clouds":{"all":0},"weather":[{"id":800,"main":"Clear","description":"Sky
>> is
>>
>> Clear","icon":"01d"}],"sys":{"country":"BY","population":1742124},"url":"http:\/\/
>> openweathermap.org\/city\/625144"}]}
>>
>> I need to get "id" value, which goes after "list":, e.g.
>> "list":[{"id":*625144*,
>>
>> I've tried to use the following regex, but without success: list(\W*)(\w*)
>>
>> Could anyone  help?
>>
>> Thanks in advance.
>>
>>
>>
>> --
>> View this message in context:
>> http://jmeter.512774.n5.nabble.com/Regular-expressions-need-help-tp5716676.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
>>
>>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message