Reputation: 3904
My git describe --long
outputs the following:
version-2.7.0-0-g10064b7
^ ^ ^
| | |
| | |
| | |--> git commit hash
| |------> commit number since last tag
|--------------> tag
Now, I want to use regex to get the commit number since last tag
and git commit hash
for my C#
program.
How can this be achieved using regex?
Upvotes: 0
Views: 440
Reputation: 1013
You can test your regex easily at http://regexpal.com/ To capture consecutive numbers use a character group [0-9], which is short for [0,1,2,3,4,5,6,7,8,9]. Dots need to be escaped with a backslash: \. The rest should be trivial.
Upvotes: 2