Help me use Regex...

  • Thread starter Thread starter Terry Olsen
  • Start date Start date
T

Terry Olsen

I have a string containing this:

MyDisk (C:)\MyDirectory\MyFile.txt

I need to change it to:

C:\MyDirectory\MyFile.txt

What, if any, Regex string would help me do this?

Thanks.
 
What if.....(just try)

stringFrom = "MyDisk (C:)\MyDirectory\MyFile.txt"
stringTo = stringFrom.Substring(stringFrom.IndexOf("(") + 1).Replace(")",
"")

Works on my VS.NET but just for this string....

Boo K.M.
 
Terry Olsen said:
I have a string containing this:

MyDisk (C:)\MyDirectory\MyFile.txt

I need to change it to:

C:\MyDirectory\MyFile.txt

What, if any, Regex string would help me do this?

I think that regular expressions are far oversized for this problem
(interesting article on this topic:
<URL:http://msmvps.com/jon.skeet/archive/2005/09/21/67247.aspx>). Check out
both the methods of the 'String' class and the members of the 'Strings'
module.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top