Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 492
  • Last Modified:

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
0
Mendokse
Asked:
Mendokse
  • 3
  • 3
1 Solution
 
jb1devCommented:
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

0
 
MendokseAuthor Commented:
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
0
 
jb1devCommented:
Does your regex support grouping / replace?
If so try:

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




0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
jb1devCommented:
I've never used Beyond Compare, but based on this:
http://www.scootersoftware.com/vbulletin/showthread.php?t=4546

I think:
Text to find: _T\(([^)]*)\)
Replace with: $1
0
 
MendokseAuthor Commented:
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.
0
 
MendokseAuthor Commented:
Solution not working but there is no solution with the used tool.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now