Announcements
The Google Cloud Community will be in read-only from July 16 - July 22 as we migrate to a new platform; refer to this community post for more details.
Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Regex to match mutliple patterns of copyright statements

I am new to regex. I have written regex to identify any pattern of copyright statement but it has many conditions and could match only in certain cases. Also need to validate for correct statement after matching the statements. All the following words to be matched no matter where it is found in a file. For example:

Copyright xyz

(c) abc

Copyright xyz@any.com

Copyright (c) www.arm.com

Copyright (c) ABC www.abc.com. all rights reserved.

(c) copyright ABC. All rights reserved. abc@any.com

Copyright ยฉ 2009 Mar FGH. All rights reserved.

(c) 2009-2020 sdf ltd. All rights reserved.

ยฉ xyz all rights reserved.

and many patterns like this in different variations.

Please check my regex here:

https://regex101.com/r/NT0c9v/1

(?:ยฉ(?:\s*Copyright)?|Copyright(?:\s*ยฉ)|\(C\)(?:\s*Copyright)|Copyright(?:\s*\(C\))?)|(?:\(C\))|\s*\d+(?:\s*-\s*\d+)?\s*(.*?(?:\W*All\s+rights\s+reserved)|[^.\n]*(?=\.)|.*)|([a-zA-Z0-9-_.]+@[a-zA-Z0-9-_.]+)

Please help me to fetch all matches. I am stuck somewhere not knowing what.

Solution to this will be highly appreciated.

0 1 406
1 REPLY 1