Unable to replace RegEx

I have the following:

Text

field id = "25" ordinal = "15" value = "& $ 01234567890- $ 2000 -"

Regular expression:

(<? = Value = "). * (? =")

Change line:

& $ 09876543210- $ 2000 -


When I launch Regex Replace in Expresso, this causes the application to crash.

If I run Regex.Replace in C #, I get the following exception:

ArgumentException

parsing "& $ 01234567890- $ 2000-" - The number of capture groups must be less than or equal to Int32.MaxValue.

+5
source share
1 answer

A $N N- , , "09876543210" ArgumentException. $ , , : & $$09876543210-$$2000-

string input = @"field id=""25"" ordinal=""15"" value=""& $01234567890-$2000-""";
string pattern = @"(?<=value="").*(?="")";
string replacement = "& $$09876543210-$$2000-";
string result = Regex.Replace(input, pattern, replacement);

, , . , .*?, [^"]*, , . : @"(?<=value="").*?(?="")" @"(?<=value="")[^""]*(?="")". , value , + * , , .

+11

All Articles