Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ regular-expression , +
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 30-Sep-11 10:42am
PJ Arends72.6K
Comments
Edward Nutting at 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/
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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

Solution 1

Regular Expressions (Visual Studio)[^] says you can use :q for find and replace.
  Permalink  
Comments
PJ Arends at 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)



Advertise | Privacy | Mobile
Web01 | 2.8.1411022.1 | Last Updated 30 Sep 2011
Copyright © CodeProject, 1999-2014
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