For Programmers: Free Programming Magazines  


Home > Archive > Visual Studio > January 2006 > Regular Expression Replace Syntax for Changing Case









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Regular Expression Replace Syntax for Changing Case
seangoogle@myexoss.com

2006-01-31, 7:03 pm

I want to write a regular expression in the Visual Studio.NET 2003
Replace Dialog that will allow me to automatically change the case of
part of the replacement text. That replacement text will typically be
a tagged expression located as part of the find. Is there a way to do
this in with VS.NET regular expressions? I can do it in successfully
using TextPad's regular expression syntax as follows, but don't want to
use TextPad just for this purpose. Here's an oversimplified example of
what I want to achieve:

--- If the source text looks like the following:

HERE is SoMe RandoM Text THAT IS in THe WrONg Case

--- The result text should look like:

here is some random text that is in the wrong case

In TextPad, I could write the following expression to achieve the
result:

Find: ^\([[:print:]]*\)
Replace: \L\1

Note the \L which forces all the characters following the switch to be
in lower case.

Any ideas?

Thanks!

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com