Or use the non-greedy operator "?":

(?i)<a .*?>(.*)?</a>

The "(?i) prefix means to ignore case; adding the "?" means that the
regex will match the first time in encounters ">" and "</a>" - rather
than looking for the longest possible match.

S.
On Tue, 7 Dec 2004 18:06:00 -0500, Kyle McAbee <[EMAIL PROTECTED]> wrote:
> Dear Avian Liao and JMeter Users List:
> 
> A regular expression can extract the value between "<a>" and "</a>". That is 
> one of the commonest tasks we can use regular expressions for.
> 
> To extract " Avian's testing " or "Today " from the examples in Avian's 
> message:
> 
> Target: <A HREF=...>target_text</A>
> Regex:  <A HREF=[^>]+>([^<]+)</A>
> 
> Note how [^>]+> in the above works: "^>" means a character that is NOT ">"; 
> and [^>]+ means one or more characters that are not ">". So if the regular 
> expression matches all characters that are not ">", followed by ">", it 
> matches all characters up to ">", but not including ">". The technique is 
> used twice, once to identify the anchor reference tag and once to identify 
> the text after the anchor reference and capture the text in a group.
> 
> To extract the value of "&_oBjEcT_Event_Var=", try this. You can see that the 
> same technique is used again.
> &_oBjEcT_Event_Var=([^']+)'
> 
> Using regular expressions to detect or extract strings describes virtually 
> all of my testing. You might consider learning more about regular 
> expressions. The Web is filled with tutorials on the subject, which is how I 
> got started. And practice! Regular expressions are not only useful, they are 
> fun. You will also find that regular expressions are built into many Java 
> products, and even some Windows products, like TextPad.
> 
> Sincerely yours,
> 
> Kyle
> 
> 
> 
> -----Original Message-----
> From: Liao, Avian [mailto:[EMAIL PROTECTED]
> Sent: Tuesday, December 07, 2004 4:19 PM
> To: Jmeter Question (E-mail)
> Subject: Can regular expression extract the value between <a> </a>
> 
> Hi, all,
> 
> If I need to extract the value after "_object_Event_var = " and also belong 
> to hyperlink "Avian's testing" , can Jmeter's regular expression extractor do 
> it? In my page, the value after "_object_Event_Var" change every time when I 
> execute this page, so I need to use regular expression to catch the value, 
> also, it would be nice to know which value that I grab(e.g. the value belongs 
> to Avian's test or Today). I tried several way, but the best I can do is just 
> use regular expression to catch the whatever value it return. But, in this 
> way, I have no full control of my test script, since I did not know where the 
> next page will go. Anyone has similar problems?
> 
> <A 
> HREF='https://erfx.uat.enporion.com/instance/processPost?_processid=3FFBE12D-2433-B334-0FF8-C3E79F5D496F&_component=Main_Page&_selfLoadingURL=%2Fdcrfxeventwizard%2FMain_Page%2Feventgui.jsp&_oBjEcT_Event_Var=ref%3A%3AEvent_LC%5B3FFBE12D-2433-C7C6-390A-03EBBF79B03E%5D'>
>  Avian's testing </A>
> 
>  <A 
> HREF='https://erfx.uat.enporion.com/instance/processPost?_processid=3FFBE12D-2433-B334-0FF8-C3E79F5D496F&_component=Main_Page&_selfLoadingURL=%2Fdcrfxeventwizard%2FMain_Page%2Feventgui.jsp&_oBjEcT_Event_Var=ref%3A%3AEvent_LC%5B3FFBE12D-243A-DBD2-623F-C07B31A1EBA3%5D'>Today
>  </A>
> 
> Avian Liao
> Software Programmer
> 
> 813-864-8198
> [EMAIL PROTECTED]
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to