[ad_1]
I am testing the following regular expression:
(^(build|ci|docs|feat|fix|perf|refactor|style|test)(\(.+\))?:(.+)?)([\S\s]+)([Cc]?loses #[\w]+ \([\S\s]+\))([\n]+(BREAKING CHANGE:[\S\s]+)?)$
On the following text:
feat: Implement retry logic for outbound requests
If outbound requests fail with a transient exception, they will be automatically
retried for a configured number of times.
This should ensure that temporary failures will more likely return success.
Closes #S2161234 (https://rally1.rallydev.com/#/?detail=/userstory/123456)
BREAKING CHANGE: Something is breaking thanks to this commit.
I tested it using regex101 and works fine.
But, using #bash scripting:
#!/bin/sh
msg=//THE LARGE MESSAGE I MENTIONED
regExp="(^(build|ci|docs|feat|fix|perf|refactor|style|test)(\(.+\))?:(.+)?)([\S\s]+)Closes"
if [[ $msg =~ $regExp ]];
then
echo "cool"
else
echo "NOT cool"
fi
It fails; Funny thing, if I remove ‘Closes’ from the regular expression, it works, I noticed the error comes from the regular expression before the word ‘Closes’ which captures everything.
Any idea how to keep using my original regexp? I need validate the message based on that structure.
[ad_2]