I have a recursive html text like:

```
string html = "<input id=\"txt0\" value=\"hello\"></input>some undefined text<input id=\"txt1\" value=\"world\"></input>";

```

that can be repeated n times (in the example n=2), but n is a variable number which is not known.

I would like to replace all text inside 'value' attribute (in the example 'hello' and 'world') with a text in an array, using regular expressions.

```
Regex rg = new Regex(which pattern?, RegexOptions.IgnoreCase);
int count= rg.Split(html).Length - 1; // in the example count = 2

for (int i = 0; i < count; i++)
{
     html= rg.Replace(html, @"value=""" + myarray[i] + @""">", 1);
}

```

My problem is that I cannot find the right regex pattern to make these substitutions.

If I use something like:

```
Regex rg = new Regex(@"value="".*""", RegexOptions.IgnoreCase);
int count= rg.Split(html).Length - 1;

for (int i = 0; i < count; i++)
{
     html= rg.Replace(html, @"value=""" + myarray[i] + @"""", 1);
}

```

I get html like

```
<input id="txt0" value="lorem ipsum"></input>

```

because .\* in the pattern includes extra characters, while I need that it stops until the next 

```
'<input'

```

occurence.

The result should be something like:

```
<input id="txt0" value="lorem ipsum"></input>some undefined text<input id="txt1" value="another text"></input>

```

A suggestion or an help would be very appreciated. 
Thanks!