0
我有perl腳本檢查SVN日誌並提取提交信息和驗證提交消息格式如下:Perl模式匹配問題而驗證
TAL: 12345, JIRA: QC-11115, BBC: ACR-12334
Program: Some definite name
Reviewer: committer name or his employee ID (5digits)
Description: Some relevant description
OR
JIRA: ABC-123
Program: Some definite name
Reviewer: committer name or his employee ID (5digits)
Description: Some relevant description:
- Some more relevant description
- Much relevant description
評論是提取並存儲在一個陣列中 - @my_comments和訪問如下
if (($my_comments[$j] =~/(((JIRA|TAL|BBC):\s{0,2}[A-Za-z0-9-]{4,15},{0,1}\s{0,2}){1,5})\nProgram:\s{0,2}[A-Za-z]{3,20}\nReviewer:\s{0,2}[A-Za-z0-9\s]{4,40}\nDescription:\s{0,2}[A-Za-z0-9\s].*/))
{ print "GOOD";
$compliance = "YES";
}
else
{ print "FAILED";
$compliance = "NO";
}
push @my_Compliance,$compliance;
.....
此外,FYR
print "ARRAY COMMENTS:$my_comments[$j]\n";
給輸出像下面預期
TAL: 12345, JIRA: QC-11115, BBC: ACR-12334
Program: Some definite name
Reviewer: committer name or his employee ID (5digits)
Description: Some relevant description
所以我懷疑問題出在我的模式匹配。任何建議請。
謝謝,解決了這個問題。 –