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