You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@jmeter.apache.org by "Liao, Avian" <al...@enporion.com> on 2004/12/08 19:29:38 UTC

share my experience with Regular expression

Hi, all, Kyle, 

I would like to share my experience when I am working on regex. 
In my case, I have to extract the value from some of my target link text, and after I extract the value from this target link text (aviianEvent), I have to use regex to extract from Result A, and this is what I did. 
===============================
 <A HREF='https://erfx.uat.enporion.com/instance/processPost?oBjEcT_Event_Var=ref%3A%3AEvent_LC%5B3FFBE12D-2433-C7C6-390A-03EBBF79B03E%5D'>Avian's testing lock event files</A>

 <A HREF='https://erfx.uat.enporion.com/instance/processPost&_oBjEcT_Event_Var=ref%3A%3AEvent_LC%5B3FFBE12D-243A-DBD2-623F-C07B31A1EBA3%5D'>Today </A>
 ============================

In my page, I have couple of links, and my target is to extract from "Avian's testing lock event files", so I use:

reference Name:avianEvent
Regex: <A HREF=[^>]+>Avian's testing lock event([^<]+)</A>
Tamplate:$0$
Match No.1
Default: noResult

Then, I add Java Request, and add this variable( extract from refex) to resultData. After this, you can add the second Regex under this Java Request, and it is :

reference Name:objectEvent
Regex: _oBjEcT_Event_Var=(ref%3A%3AEvent_LC%5B\w*-\w*-\w*-\w*-\w*%5D)
Tamplate:$1$
Match No.0
Default: noResult

=========================================
Thanks all the help from you, specially from Kyle. Cannot go this far without your help.

AL

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org


Re: share my experience with Regular expression

Posted by sebb <se...@gmail.com>.
On Wed, 8 Dec 2004 13:29:38 -0500, Liao, Avian <al...@enporion.com> wrote:
> Hi, all, Kyle,
> 
> I would like to share my experience when I am working on regex.
> In my case, I have to extract the value from some of my target link text, and after I extract the value from this target link text (aviianEvent), I have to use regex to extract from Result A, and this is what I did.
> ===============================
>  <A HREF='https://erfx.uat.enporion.com/instance/processPost?oBjEcT_Event_Var=ref%3A%3AEvent_LC%5B3FFBE12D-2433-C7C6-390A-03EBBF79B03E%5D'>Avian's testing lock event files</A>

This needs (?i) as a prefix in order to match <a ...> ... </a>

> 
>  <A HREF='https://erfx.uat.enporion.com/instance/processPost&_oBjEcT_Event_Var=ref%3A%3AEvent_LC%5B3FFBE12D-243A-DBD2-623F-C07B31A1EBA3%5D'>Today </A>
>  ============================
> 
> In my page, I have couple of links, and my target is to extract from "Avian's testing lock event files", so I use:
> 
> reference Name:avianEvent
> Regex: <A HREF=[^>]+>Avian's testing lock event([^<]+)</A>
> Tamplate:$0$
> Match No.1
> Default: noResult
> 
> Then, I add Java Request, and add this variable( extract from refex) to resultData. After this, you can add the second Regex under this Java Request, and it is :
> 
> reference Name:objectEvent
> Regex: _oBjEcT_Event_Var=(ref%3A%3AEvent_LC%5B\w*-\w*-\w*-\w*-\w*%5D)
> Tamplate:$1$
> Match No.0
> Default: noResult

You can use multiple Regex Extractors on the same sampler - but be
aware that the order in which they are applied is not guaranteed, so
they cannot use each other's output.

You could also use the groups feature of the Regex Extractor to
extract multiple strings using a single Regex.

See http://wiki.apache.org/jakarta-jmeter/RegularExpressions which
I've just updated with an example.

Also see http://jakarta.apache.org/jmeter/usermanual/component_reference.html#Regular_Expression_Extractor

S.

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: jmeter-user-help@jakarta.apache.org