Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

RajanSky

Regular Expressions in Visual Studio

This topic is 5778 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi! I just found out you can write regular expressions inside Visual Studio "Find/Replace" dialog boxes. Wow, this is really useful.. However, when I try to include the newline \n, inside the expression, it just acts as if I typed the letter n! Does anyone know how to include the newline character? Thanks a lot! Raj

Share this post


Link to post
Share on other sites
Advertisement
Hmm thanks a lot! That seems to work for finding the end of the line. When I try to actually insert an end-of-line though, using the Replace dialog box, it just inserts a dollar sign. Any idea of how to get around that?

Thanks a lot!

Edit: By the way, it might help to show what I'm trying to do. Basically, I'm trying to generate empty functions from the prototoypes, because this saves a lot of redundant manual editing. So, say I had this bunch of functions taken from a "Graphics" class:

Graphics();
void SetMode(int modeNumber);
void VSync();

Then, I could use regular expressions to convert this into:

Graphics::Graphics()
{
}

void Graphics::SetMode(int modeNumber)
{
}

void Graphics::VSync()
{
}

But, since I can't get newlines to work on the "Replace" dialog box, all I end up with is stuff like this:

Graphics::Graphics() {}
void Graphics::SetMode(int modeNumber) {}
void Graphics::VSync() {}

Thanks =)

Raj

[edited by - Rajansky on January 21, 2003 9:35:11 AM]

Share this post


Link to post
Share on other sites
You''re going to have to go back and edit it anyway so you could leave it as it is. You''ll need to make sure you return the correct type for non-void returns. Not hard, but a bit precarious if you ask me, you''ll have code which compiles nicely enough but does nothing.

If it''s backed up with tests and you''re following the practice of writing code which deliberately fails first time through, just to get the tests in place, then you''ll have a better chance of catching the bugs.

Share this post


Link to post
Share on other sites
I guess you could cut and paste a new line from the text editor into the replace box. I do that a bit with tabs (which you can''t type into there either).

If I had my way, I''d have all of you shot!


codeka.com - Just click it.

Share this post


Link to post
Share on other sites
Actually, you can do tabs, with \t

Ahh oh well I give up, I don''t think it can be done in VS 6. I guess, maybe there''s some better way to do it using Visual Studio macros.

Raj

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!