如何为缺少版权和许可的曲目配置正则表达式 headers

How to configure regex for Track lack of copyright and license headers

我遇到错误 "Add or update the header of this file."。我用正则表达式 header 格式设置了 isRegularExpression=true。

Header格式

^[a-z,A-Z, ,#,0-9]*
\/\*\s*
\s*\* SampleSonarQube\s*
\s*\* Copyright \(c\) [0-9]{4}-[0-9]{4} XYZ corporation\s*
\s*\* ProjectName:[a-z,A-Z,.]*\s*
\s*\* [a-z,A-Z,.]*\s*
\s*\* Created On: [0-3]?[0-9]-[0-3]?[0-9]-[0-9]{4}\s*
\*\/\s*
[a-z,A-Z, ,#,0-9]*$

样本Header

#region copyright
/*
 * SampleSonarQube
 * Copyright (c) 2017-2018 XYZ corporation
 * ProjectName:MyProject
 * Testclass.cs
 * Created On: 8-11-2018
*/
#endregion

using ....

谁能帮我找出错误?

第一行末尾缺少空格模式。

请尝试使用此正则表达式模式。

^[a-z,A-Z, ,#,0-9]\s/*\s*\s** SampleSonarQube\s*\s** 版权所有(c) [0-9]{4}-[0-9]{4} XYZ corporation\s*\s** 项目名称:[a-z,A-Z,.]\s\s** [a-z,A-Z,.]\s\s** 创建于:[0-3]?[0-9]-[0-3]? [0-9]-[0-9]{4}\s**/\s*[a-z,A-Z,#,0-9]*$