1

I'm attempting to create a regular expression to use as a filter in DeltaWalker. I want to identify the files that had code updated in a library that our project uses, but the library source files have all had a single line, Copyright (c) 2008 - 2009 changed to Copyright (c) 2008 - 2010. I'd like to ignore those lines because otherwise most files contain the same source code.

Nimantha
  • 6,405
  • 6
  • 28
  • 69

3 Answers3

1
^.*Copyright.*$

matches an entire line if it contains the word Copyright.

^(?:(?!Copyright).)*$

matches an entire line if it does not contain the word Copyright.

Which one you need to use depends on how filtering works in DeltaWalker.

EDIT: If you only want to match lines that follow the specific format you quoted, then you could use

^\s*Copyright\s*\(c\)\s*\d+\s*-\s*\d+\s*$
Tim Pietzcker
  • 328,213
  • 58
  • 503
  • 561
  • Thank you. Curious, DeltaWalker's filtering doesn't seem to be working. Not being familiar with regular expressions, I thought I'd test your solution with: find . -exec grep -Hn '^.*Copyright.*$' {} \; in OS X's Terminal. It works perfectly with grep, but not with DeltaWalker filtering. –  Nov 24 '10 at 17:54
0

If you're not wanting the 2010 stuff, you can do this.

^.*Copyright \(c\) 2008 - 2009.*$

Keng
  • 52,011
  • 32
  • 81
  • 111
0

Don't know much about DeltaWalker, but this regexp should will match both "Copyright (c) 2008 - 2009" and "Copyright (c) 2008 - 2010"

/Copyright \(c\) 200(8|9) - 20(09|10)/

You can try out different regular expressions easily with this site:

http://www.rubular.com

bowsersenior
  • 12,524
  • 2
  • 46
  • 52