Click here to Skip to main content
11,927,711 members (59,067 online)
Rate this:
Please Sign up or sign in to vote.
See more: C++ Visual-Studio , +
I recently downloaded some source files that seem to be exactly what I need for a project of mine. The only problem is that it is written for ANSI builds only, it has no UNICODE support.

I now want to change all string literals from "text text" to _T("text text") by wrapping them in the _T macro to make them unicode compliant.

What would be the regular expression that I could use in visual studio's 'Find and Replace' dialog that would change all the strings for me?

I know next to nothing about regular expressions so any help would be appreciated.

Posted 30-Sep-11 10:42am
PJ Arends78.1K
Edward Nutting 30-Sep-11 16:35pm
You may want to have a look at the following online RegExp tool - it uses Flash but I have found it fantastic for creating and testing RegExp as it lists all the syntax for RegExp and lets you build it up quickly and easily, also has some premade stuff and splits your expression to show you what it's matching (or any errors!) :)
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

Try this :
search for : \".*\"
replace with : _T(\0)
PJ Arends 30-Sep-11 16:02pm
Thanks a bunch, works perfectly :)
Mehdi Gholam 30-Sep-11 16:35pm
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Regular Expressions (Visual Studio)[^] says you can use :q for find and replace.
PJ Arends 30-Sep-11 16:03pm
Seen that, tried that, could not get it to work for some reason.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.151126.1 | Last Updated 30 Sep 2011
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100