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 10:10:12 GMT
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