Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Visual Studio.NET / Extensibility / June 2006

Tip: Looking for answers? Try searching our database.

Regular expression to delete end-of-line comments

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
SamP - 30 May 2006 21:56 GMT
Hi All,

I am attempting to write a macro to delete end-of-line comments containing
preceding code using a regular expression.

eg:

// This is the constructor of a class that has been exported. NOT TO BE
DELETED
                       // see dll_three.h for the class definition NOT TO
BE DELETED
//
Cdll_three::Cdll_three()
{
std::cout << "In // " __FUNCTION__ << std::endl;// jjj -  TO BE DELETED
}// example - TO BE DELETED
Cdll_three::~Cdll_three()/// example - TO BE DELETED
{
std::cout << "In " __FUNCTION__ << std::endl; // /*TO BE DELETED*/
}/* TO BE DELETED*/

As my skill in regular expressions is seemingly insuffient to master this
problem can anyone help or point me to an another source of help.

Thanks
SamP
Mirko Matytschak - 07 Jun 2006 14:17 GMT
[^\s]+(//.*)

gives you in Match.Groups[1] the string to be deleted.

Mirko

> Hi All,
>
[quoted text clipped - 22 lines]
> Thanks
> SamP

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.