Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7600269
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T22:52:14+00:00 2026-05-30T22:52:14+00:00

I am writing a script to remove git commit tags (eg Signed-off-by:, Reviewed-by: )

  • 0

I am writing a script to remove git commit tags (eg Signed-off-by:, Reviewed-by:) from each git commit message. Currently the script is in python. Right now I have a very simple re.match("Signed-off-by:", line) check. But I think there should be more elegant solution using regular expression.

I am assuming that a footer will begins with [more words separating by -]: For example

Bug:, Issue:, Reviewed-by:, Tested-by:, Ack-by:, Suggested-by:, Signed-off-by:

The pattern should ignore case. I need help coming up with a solution using regular expression for this. I also want to learn more about RE, what is a good starting point?

The actual python script is here https://gerrit-review.googlesource.com/#/c/33213/2/tools/gitlog2asciidoc.py

You could also comment on the script if you sign up for an account.

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T22:52:16+00:00Added an answer on May 30, 2026 at 10:52 pm
    >>> def match_commit(s):
        r = re.compile(r'((\w+*)+\w+:)')
        return re.match(r, s) is not None
    
    >>> match_commit("Signed-off-by:")
    True
    >>> match_commit("Signed-off+by:")
    False
    >>> match_commit("Signed--by:")
    False
    >>> match_commit("Bug:")
    True
    >>> match_commit("Bug-:")
    False
    

    The 1st group (\w+-)* captures 0 to any repetitions of patterns “word + ‘-‘”, the last one \w+: looks for the last word + ‘:’.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a SQL script to remove some rows from my table. I need
I'm writing a script to remove some build artifacts older than 1 week. The
I am writing a script at the moment that will grab certain information from
I am writing a script which is likely to be modified by users. Currently
I'm writing a script in python which basically queries WMI and updates the information
I'm writing a PHP script to generate SQL dumps from my database for version
For some reason, my script isn't writing out the text after I remove the
I'm writing a shell script that outputs all untranslated strings from gettext .po file,
I am writing an Ant script that removes content from a properties file. Say
I'm writing a python script to perform some basic CM functions like tagging in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.