Link to home
Start Free TrialLog in
Avatar of Mendokse
MendokseFlag for France

asked on

regular expression : compare code with and without unicode _T macro

Hi Experts,
I have to maintain two versions of a soft. One has been migrated to support unicode strings (using _T macro), the other one not.
When I compare my 2 versions, all strings are shown as different because of _T macro...
I didn't find how to build a regular expression in beyond compare to tell that I don't want it to show this as a difference.
Any help would be greatly appreciated !
Thanks in advance
Avatar of jb1dev
jb1dev

I guess you are using some diff tool which allows you to define a regex to first massage the data before diffing? That part's not clear to me, but a regex to remove _T() from your file would be:

's/_T([^)]*)//g

Avatar of Mendokse

ASKER

Hello jb1dev
Thanks for your help !

"I guess you are using some diff tool which allows you to define a regex to first massage the data before diffing?". You're totally right. I'm using beyond compare which allows to create "rules" to exclude parts of the files to diff.

Using your proposal, I found that the folowwing expression is almost working
_T\([^)]*\)
But, this expression excludes all the text between parenthesis, and I only want to exclude _T(), not what's inside.
For example,
if I compare _T("this is a test") and "this is a test", I want no diff
but
if I compare _T("This is my test") and "this is a test", I want this to be shown as a diff....

I hope I'm more clear than in my first message...
Thanks
Does your regex support grouping / replace?
If so try:

s/_T\(([^)]*)\)/$1/g




ASKER CERTIFIED SOLUTION
Avatar of jb1dev
jb1dev

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks for the help, but it seems it can't work the way I want... Beyond Compare is really weird.
BTW, thank you for the effort, I give you points for this.
Solution not working but there is no solution with the used tool.