Reputation: 145
Suppose I want to check that my every scala file has a header similar to
/*
* Copyright (c) 2020-2021 XYZ company ltd
* All Rights Reserved.
*/
Now the scalastyle_config.xml has an entry like
<check enabled="true" class="org.scalastyle.file.HeaderMatchesChecker" level="warning">
<parameters>
<parameter name="regex">true</parameter>
<parameter name="header">Copyright (c) 2020-2021 XYZ company ltd</parameter>
</parameters>
</check>
What should be the regex to match the header content I pasted above?
I tried specifying the parameter as
<parameter name="header">Copyright \(c\) (?:\d{4}-)?\d{4} XYZ company ltd</parameter>
but even that doesn't match my header and it fails the headerCheck.
Upvotes: 0
Views: 155