I am trying to replace all the urls from a file with others
To this end I do something like this:
private static void findAndReplaceImgURLs(string s) { var server = HttpContext.Current.Server; var cssLines = File.ReadLines(server.MapPath(s)); int indexer = 0; foreach (string line in cssLines) { int startPosition = line.IndexOf("url(\""); int endPosition = line.IndexOf(".png)"); if (startPosition != -1 && endPosition != -1) { //replace urls } indexer++; } } I DON’T want to just replace all the strings from a certain index, I want to replace from one index to another all the chars in between. How can I do this?
Regex.Replacefor this.foreachloop. What should happen to the modified line; where should it go?