Return-Path: X-Original-To: apmail-jmeter-user-archive@www.apache.org Delivered-To: apmail-jmeter-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id DC4ED101FC for ; Fri, 12 Jul 2013 14:47:54 +0000 (UTC) Received: (qmail 17415 invoked by uid 500); 12 Jul 2013 14:47:54 -0000 Delivered-To: apmail-jmeter-user-archive@jmeter.apache.org Received: (qmail 17287 invoked by uid 500); 12 Jul 2013 14:47:52 -0000 Mailing-List: contact user-help@jmeter.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "JMeter Users List" Delivered-To: mailing list user@jmeter.apache.org Received: (qmail 17276 invoked by uid 99); 12 Jul 2013 14:47:51 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Jul 2013 14:47:51 +0000 X-ASF-Spam-Status: No, hits=0.4 required=5.0 tests=RCVD_IN_DNSWL_LOW,SPF_PASS,TRACKER_ID X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of sebbaz@gmail.com designates 74.125.82.44 as permitted sender) Received: from [74.125.82.44] (HELO mail-wg0-f44.google.com) (74.125.82.44) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 12 Jul 2013 14:47:45 +0000 Received: by mail-wg0-f44.google.com with SMTP id m15so8233798wgh.35 for ; Fri, 12 Jul 2013 07:47:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=SF4Y9TBG3uYzPZKtW7Cxr/C+ObsQP4G06kOAyyNSDeM=; b=jhbRde+INqZsg6oDP8/ywi4jN8qLOfsX+lYt0X5URnu+Nxh0A2MystiuGZ0LVVGtfs s99EYgszYgiljefrPtHevVLXbFxwgv1tRdNDkOPXNTJRnnWVj4ZBdbk/3E6mRSuXbv9w 7phXOlNOvLRQlKh8II7eGgFIRbvpYErcnVkPvvgYDjS7VXJIeDIDdjmQDhL36P4PUv41 NzVPFijI0rT1Q98WQpXX5pqUk9Y1xsq/JVZjRtaSgWPadx+EMXveq9pNv5bdebFFAgjQ zt7zPEZTbY5HvlvGbe0JtYc8k37OkARdkngF3uepxYGE2hhQ9VSo8fbZPZRi6fRTdT2L XIJQ== MIME-Version: 1.0 X-Received: by 10.180.90.240 with SMTP id bz16mr1886701wib.24.1373640444876; Fri, 12 Jul 2013 07:47:24 -0700 (PDT) Received: by 10.194.152.103 with HTTP; Fri, 12 Jul 2013 07:47:24 -0700 (PDT) In-Reply-To: References: Date: Fri, 12 Jul 2013 15:47:24 +0100 Message-ID: Subject: Re: Regular expression help From: sebb To: JMeter Users List Content-Type: text/plain; charset=ISO-8859-1 X-Virus-Checked: Checked by ClamAV on apache.org On 12 July 2013 09:57, Niraj 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