jmeter-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niraj <niraj.khatm...@gmail.com>
Subject Re: Regular expression help
Date Mon, 15 Jul 2013 11:28:56 GMT
Finally i was able to extract. I have used.

test.FilterPanel.viewId = (\\\\\\\.*)"([^\\]+)

thanks guys for the guidance.


On Mon, Jul 15, 2013 at 4:31 PM, Manish Sapariya <msapariya@gmail.com>wrote:

> Niraj,
> If you have " in your response body you don't need any escaping.
>
> So if the string is "138844c6-a873-4867-8cf4-8a7bc5429537" (with double
> quotes)
>
> and hence regex will simply be :  "([-a-f\d]+)" as suggested by sebb.
>
> If you have \ in your response you , you will have to
> escape as \\"([-a-f\d]+)"\\
>
> Hope this helps.
> Thanks and Regards,
> Manish
> kPoint wins *Global eLearning
> Award<http://www.kpoint.com/kpoint-wins-learntech-global-e-learning-award/
> >
> * in “Learning Technologies Solution”!
>
>
> On Mon, Jul 15, 2013 at 3:40 PM, Niraj <niraj.khatmode@gmail.com> wrote:
>
> > I have tried both the regex but unfortunately it's not working.
> >
> > test.FilterPanel.viewId =
> \\\"138844c6-a873-4867-8cf4-8a7bc5429537\\\";\"}
> >
> > i want to extract 138844c6-a873-4867-8cf4-8a7bc5429537.
> >
> > Please let me know regex to extract required value.
> >
> > Thanks,
> > Niraj
> >
> >
> > On Mon, Jul 15, 2013 at 10:45 AM, Niraj <niraj.khatmode@gmail.com>
> wrote:
> >
> > > Thanks Guys for the quick response.
> > >
> > > Currently my application is down due to some issue. Once it is up, i
> will
> > > check this regex and will let you know the results.
> > >
> > >
> > >
> > >
> > > On Fri, Jul 12, 2013 at 8:17 PM, sebb <sebbaz@gmail.com> wrote:
> > >
> > >> On 12 July 2013 09:57, Niraj <niraj.khatmode@gmail.com> wrote:
> > >> > Can someone please help me in regular expression
> > >> >
> > >> >
> > >> > test.FilterPanel.viewId = \"136e6c9e-689a-4d24-a3bc-2ace008bee2f\"
> > >>
> > >> > *i want to extract **136e6c9e-689a-4d24-a3bc-2ace008bee2f **from
> >  this.
> > >> *
> > >> >
> > >> > *Please let me know what should be correct reg ex *
> > >> > *
> > >> > *
> > >> > *i tried **viewId = \"(.*)\ But got the
> > >> > error org.apache.oro.text.MalformedCachePatternException: Invalid
> > >> > expression: viewId = \"(.*)\*
> > >> > *Trailing \ in expression.*
> > >>
> > >> It's quite difficult reading your posting because of all the extra *
> > >> characters that are scattered about.
> > >>
> > >> But assuming you start with
> > >>
> > >> test.FilterPanel.viewId = \"136e6c9e-689a-4d24-a3bc-2ace008bee2f\"
> > >>
> > >> and want to extract
> > >>
> > >> 136e6c9e-689a-4d24-a3bc-2ace008bee2f
> > >>
> > >> Then the way to do it is to take your input, and escape any
> > >> meta-characters:
> > >> In this case, the \ is the only special char, so it becomes:
> > >>
> > >> test.FilterPanel.viewId = \\"136e6c9e-689a-4d24-a3bc-2ace008bee2f\\"
> > >>
> > >> Now put () around the part you want to extract:
> > >>
> > >> test.FilterPanel.viewId = \\"(136e6c9e-689a-4d24-a3bc-2ace008bee2f)\\"
> > >>
> > >> Of course this will only extra the exact id, so now you need to make
> > >> the id dynamic.
> > >>
> > >> In this case, the Id seems to consist of lower-case hex and - only,
> > >> which is matched by
> > >>
> > >> [-\da-f]+
> > >>
> > >> In the above, the - must come first, otherwise it is treated as a
> > >> range, as in a-f.
> > >> The \d means digit; you could use 1-9 instead
> > >>
> > >> So the final expression becomes:
> > >>
> > >> test.FilterPanel.viewId = \\"([-\da-f]+)\\"
> > >>
> > >> If the Id could include other characters, you could also use the fact
> > >> that it is terminated by \, so you could replace
> > >>
> > >> [-\da-f]+
> > >>
> > >> by
> > >>
> > >> [^\\]+
> > >>
> > >> which means anything except \, repeated any number of times.
> > >>
> > >> Try this process out in the Tree View Listener regex pane.
> > >>
> > >> > *
> > >> > *Thanks,*
> > >> > *Niraj*
> > >> > *
> > >> > *
> > >> > *
> > >> > *
> > >> > *
> > >> > *
> > >>
> > >> ---------------------------------------------------------------------
> > >> 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