regular expression : compare code with and without unicode _T macro

Posted on 2009-12-21
Last Modified: 2013-12-14
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
Question by:Mendokse
    LVL 14

    Expert Comment

    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:



    Author Comment

    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
    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
    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...
    LVL 14

    Expert Comment

    Does your regex support grouping / replace?
    If so try:


    LVL 14

    Accepted Solution

    I've never used Beyond Compare, but based on this:

    I think:
    Text to find: _T\(([^)]*)\)
    Replace with: $1

    Author Comment

    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.

    Author Closing Comment

    Solution not working but there is no solution with the used tool.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    Need Reg Ex to accept  "0"  Zero 6 59
    Java eclipse error 2 60
    Php - Replacement of words in an string 3 24
    pattern problem 9 58
    Here is a helpful source code for C++ Builder programmers that allows you to manage and manipulate HTML content from C++ code, while also handling HTML events like onclick, onmouseover, ... Some objects defined and used in this source include: …
    How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from ( Go to that link and select download selenium in the right hand columnThat will then direct you to their downlo…
    The viewer will learn how to use and create keystrokes in Netbeans IDE 8.0 for Windows.
    The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    18 Experts available now in Live!

    Get 1:1 Help Now