On 15/12/2009, Adrian Speteanu <[email protected]> wrote:
> if the id is made only of digits, I usually use (\d+) to extract all of
>  them; example:
>
>   \"item_id\": \"(\d+)\"

No need to escape the double-quotes, so:

"item_id": "(\d+)"

is equivalent.

>  the (\d+) example should work especially when the digits are surrounded by
>  other pieces of text that you don't want to extract (if the expression is
>  too general it will extract a lot of other numbers).
>  someone correct me if the syntax is too sloppy , but it works in all cases
>  i've encountered...
>
>  if the id is made of other characters too, you could use:  (.+)
>

That will match everything.

Better to use

([^"]+)

which will match anything except " - there is then no need to back-track.

>
>  On Tue, Dec 15, 2009 at 2:02 PM, Babak Shafian <[email protected]> wrote:
>
>  >
>  > Thanks for the response,
>  >
>  > just one problem: your supposed regex returns the last cipher but I wanted
>  > to get the whole number! I checked the don on regular expression but
>  > couldn't figure out.
>  >
>  > Thanks in advance
>  > Babak
>  >
>  > > Date: Mon, 14 Dec 2009 08:57:13 -0800
>  > > Subject: Re: Dynamic parameters!
>  > > From: [email protected]
>  > > To: [email protected]
>  > >
>  > > Adda regex extractor post processor  [ regex=item_id"[^"]*"([^"])*" ,
>  > > template=$1$, reference name=itemId, matchnumber = 1] to the first
>  > request
>  > > and use the variable(itemId in example above) you define there as the
>  > path
>  > > of the next request. (/SemanticEngine/programs/${itemId}   See the docs
>  > for
>  > > help on regular expression extractor .
>  > >
>  > > regards
>  > > deepak
>  > >
>  > > On Mon, Dec 14, 2009 at 8:47 AM, Babak Shafian <[email protected]>
>  > wrote:
>  > >
>  > > >
>  > > > Hi all,
>  > > >
>  > > > I get the following response data for my first HTTP request:
>  > > >
>  > > >    "item_id": "4573815200912140050",
>  > > >    "channel_id": "Vox",
>  > > >    "title": "James Bond",
>  > > >    "genre": [{"name": "Action"}]
>  > > >
>  > > > I want to extract the value of item_id (above number) to use it in the
>  > path
>  > > > of the second HTTP request like that:
>  > > >
>  > > > Path: /SemanticEngine/programs/item_id
>  > > >
>  > > > Is there any possibility in JMeter to do it??
>  > > >
>  > > > Thanks in advance!
>  > > > Babak
>  > > >
>  > > >
>  > > >
>  > > >
>  > > >
>  > > >
>  > > > _________________________________________________________________
>  > > > Windows Live: Make it easier for your friends to see what you’re up to
>  > on
>  > > > Facebook.
>  > > >
>  > > >
>  > 
> http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_2:092009
>  >
>  > _________________________________________________________________
>  > Windows Live: Friends get your Flickr, Yelp, and Digg updates when they
>  > e-mail you.
>  >
>  > 
> http://www.microsoft.com/middleeast/windows/windowslive/see-it-in-action/social-network-basics.aspx?ocid=PID23461::T:WLMTAGL:ON:WL:en-xm:SI_SB_3:092010
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to