Click here to Skip to main content
15,881,600 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
See more: , +
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.

Thanks.
Posted
Comments
Ed 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!) :) http://gskinner.com/RegExr/

Try this :
search for : \".*\"

replace with : _T(\0)
 
Share this answer
 
Comments
PJ Arends 30-Sep-11 16:02pm    
Thanks a bunch, works perfectly :)
Mehdi Gholam 30-Sep-11 16:35pm    
Cheers
Regular Expressions (Visual Studio)[^] says you can use :q for find and replace.
 
Share this answer
 
Comments
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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900