[英]GIT describe output regex to get commit data
My git describe --long
outputs the following: 我的
git describe --long
输出以下内容:
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. 现在,我想使用正则表达式获取
C#
程序的commit number since last tag
和git commit hash
的commit number since last tag
。
How can this be achieved using regex? 如何使用正则表达式来实现?
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]. 您可以在http://regexpal.com/上轻松测试您的正则表达式。要捕获连续的数字,请使用字符组[0-9],该字符组是[0,1,2,3,4,5,6,7, 8,9]。 Dots need to be escaped with a backslash: \\.
点必须以反斜杠转义:\\。 The rest should be trivial.
其余的应该是微不足道的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.