0

I need to diff two different version of the same app. The files are signed with a licences and that license has changed.

I don't want that files that contain the license only diff are signed as different.

I use Meld as diff software and it allows for regex.

<?php
/**
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the License ....
 *
 */

There are similar questions but none is working for me:

  1. RegEx to remove /** */ and // ** **// php comments

  2. How can I perform a diff that ignores all comments?

Regex tried:

\/\*.*?\*\/|\/\/.*?\n
~//?\s*\*[\s\S]*?\*\s*//?~

Actually this one looks to works but I'm not sure it is filtering too much:

\*.*

UPDATE:
This is not possible: https://mail.gnome.org/archives/meld-list/2011-December/msg00004.html

While the filter code in Meld will happily accept a regex that covers (and removes) multiple lines, this causes line mismatches between the text the diff sees and the text that we display, so all of the change blocks will be wrong.

Different approach is to remove the lines from the files before process them into meld.

Community
  • 1
  • 1
WonderLand
  • 5,494
  • 7
  • 57
  • 76

2 Answers2

0
\s*\/\*.*|\s*\*.*

Well obviously meld doesn't accept all python regex as a text filter, no multiline nor "|" inside brackets. So this solution excludes lines beginning with a star and "/*" with optional spaces. It does not filter out all php comments precisely, but may well work for your files.

Also have a look at that: https://mail.gnome.org/archives/meld-list/2011-December/msg00004.html

JosefScript
  • 581
  • 6
  • 15
0

this regex is easier for multiline usage:

  .*\/\*[^\/]+\/\s
Sebastian Viereck
  • 5,455
  • 53
  • 53