Regular Expressions 101

Community Patterns

Missing copyright detector for Visual Studio (.NET)

0

Regular Expression
.NET 7.0 (C#)

@"
(?s-i)\A(?!.*\bCopyright MyCompany Ltd. All Rights Reserved\b).+
"
gm

Description

Detects one match per file if that file is missing the expected copyright text. This works with Visual Studio IDE. If you are using Rider (PCRE2), you can replace both \b entries with \Q then \E

Submitted by Kris Morness - 2 years ago