From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-3.8 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CACACC388F9 for ; Fri, 23 Oct 2020 21:04:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 655B82085B for ; Fri, 23 Oct 2020 21:04:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1750738AbgJWVER (ORCPT ); Fri, 23 Oct 2020 17:04:17 -0400 Received: from smtprelay0175.hostedemail.com ([216.40.44.175]:41532 "EHLO smtprelay.hostedemail.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S463274AbgJWVER (ORCPT ); Fri, 23 Oct 2020 17:04:17 -0400 Received: from filter.hostedemail.com (clb03-v110.bra.tucows.net [216.40.38.60]) by smtprelay05.hostedemail.com (Postfix) with ESMTP id 3A7C718029123; Fri, 23 Oct 2020 21:04:16 +0000 (UTC) X-Session-Marker: 6A6F6540706572636865732E636F6D X-HE-Tag: cause33_34001332725c X-Filterd-Recvd-Size: 1685 Received: from XPS-9350.home (unknown [47.151.133.149]) (Authenticated sender: joe@perches.com) by omf08.hostedemail.com (Postfix) with ESMTPA; Fri, 23 Oct 2020 21:04:15 +0000 (UTC) Message-ID: <4317722a8dc93b6de1dc974a8cb51c7f22d86ecf.camel@perches.com> Subject: Re: [PATCH RFC v2] checkpatch: extend attributes check to handle more patterns From: Joe Perches To: Dwaipayan Ray Cc: linux-kernel-mentees@lists.linuxfoundation.org, linux-kernel , Lukas Bulwahn Date: Fri, 23 Oct 2020 14:04:13 -0700 In-Reply-To: References: <20201023094307.20820-1-dwaipayanray1@gmail.com> <2e8279841d604dde8a3335c092db921007f6744e.camel@perches.com> <2a3b90ee-b9bd-2586-9d68-45cbf7e499a9@gmail.com> <8710630d8c01bf6f3749e3d11d193a805f2d2048.camel@perches.com> Content-Type: text/plain; charset="ISO-8859-1" User-Agent: Evolution 3.38.1-1 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, 2020-10-24 at 02:27 +0530, Dwaipayan Ray wrote: > Also I tried the pattern attr =~ s/^_*(.*)_*$/$1/ > for trimming the _ earlier. I think it doesn't trim the > trailing underscores in the suffix as (.*) captures everything greedily. > > Is the iterative one perhaps okay instead? > while($attr =~ s/(.*)_$/$1/) {} Then perhaps $curr_attr =~ s/^_+//; $curr_attr =~ s/_+$//;