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 6144123
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T18:36:32+00:00 2026-05-23T18:36:32+00:00

So i need to parse thing like this : commit e397a6e988c05d6fd87ae904303ec0e17f4d79a2 Author: Name <email@email.com>

  • 0

So i need to parse thing like this :

commit e397a6e988c05d6fd87ae904303ec0e17f4d79a2
Author: Name <email@email.com>
Date:   Sat Jul 9 21:29:10 2011 +0400

    commit message

 1 files changed, 21 insertions(+), 11 deletions(-)

and get Author name and number of insertions and deletions.

For the name i have this:

re.findall(r"Author: (.+) <",gitLog)

For the numbers i have this:

re.findall(r" (\d+) insertions\S+, (\d+) deletions",gitLog)

But i want to get a list of tuples of name,insertions and delitions with one regular-expression.

I tryed to do somthing like

re.findall(r"Author: (.+) <.+ (\d+) insertions\S+, (\d+) deletions",gitLog,re.DOTALL)

but it returns nothing…

So what is my mistake? How regular-expression should look like?

UPADTE:
wRAR is right, but somehow when i read i file and try to parse it i get the whole file as a name , and then last insertion and deletion, so it matches the whole file but not a single commit… [.+] gets the whole file but not a part of a commit…

  • 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-23T18:36:32+00:00Added an answer on May 23, 2026 at 6:36 pm

    If you have access to the repo and not some text dump of git log, save yourself the parsing trouble and generate different log output:

    git log --pretty="%an" --numstat
    

    Will produce output of the form:

    Author Name

    lines_inserted lines_deleted modified_file

    Which you don’t even need regex for. If you want to keep with regex, you need to match the (+) after insertions or else it will not match at all and not capture the numbers.

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

Sidebar

Related Questions

I need to parse a string like February 12, 1981 as a Date. I
I have a string like this that I need to parse into a 2D
Need to parse a file for lines of data that start with this pattern
I need to parse a string like func1(arg1, arg2); func2(arg3, arg4); . It's not
A need some help, I have a TextBlock that contains a string like this
I need to parse an xml File in C#...The File will look some thing
I have a weird problem, I need to parse a date string that looks
I need parse through a file and do some processing into it. The file
I have a rather big number of source files that I need parse and
I need to parse a xml file which is practically an image of a

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.