Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Regex replace and pattern match

Status
Not open for further replies.

Badgers

Programmer
Nov 20, 2001
187
0
0
US
Hi,

I am opening up a text file and doing a find and replace on a number of params. On example;

ServerUrl=http://localhost/site

Instead of doing an explicit find on the whole string, I want to locate the string up to the =, and then replace the entire contents with a new value.

This is to cater for the case, if default values are changed in source control.

At present just doing a simple

contents = Regex.Replace(contents, oldValue, newValue);

Thanks inadvance.

Tim.
 
>Instead of doing an explicit find on the whole string, I want to locate the string up to the =, and then replace the entire contents with a new value.
Concretely what does it mean? entire contents, meaning? up to the =? or the [ignore][/ignore]? To me, not at all clear? Maybe only me!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top